Browse Source

* Make App::get_router work
* Include the correct file for the events interface

Nathaniel van Diepen 8 years ago
parent
commit
9ba5eddb7d
2 changed files with 18 additions and 3 deletions
  1. 11 3
      app.class.php
  2. 7 0
      router.class.php

+ 11 - 3
app.class.php

@@ -2,7 +2,7 @@
 	require_once('base.class.php');
 	require_once('router.class.php');
 	require_once('response.class.php');
-	require_once('events.class.php');
+	require_once('events.interface.php');
 	class App extends Base implements Events {
 		private static $apps = array();
 		private $routers;
@@ -64,10 +64,18 @@
 
 		}
 		public function get_router($type, $path){
-
+			$ret = false;
+			if(isset($this->routers[$type])){
+				foreach($this->routers[$type] as $k => $router){
+					if($router->base == $path){
+						$ret = $router;
+					}
+				}
+			}
+			return $ret;
 		}
 		public function create_router($type, $path){
-			$router = new Router();
+			$router = new Router($path);
 			if(!isset($this->routers[$type])){
 				$this->routers[$type] = array();
 			}

+ 7 - 0
router.class.php

@@ -13,6 +13,13 @@
 				$this->base($base);
 			}
 		}
+		public function __get($name){
+			switch($name){
+				case 'base':
+					return $this->_base;
+				break;
+			}
+		}
 		public function __clone(){
 			// No cloning
 		}