예제 #1
0
파일: Singleton.php 프로젝트: sw04/route-me
 public static function getInstance()
 {
     if (null === self::$_router) {
         self::$_router = new Router();
     }
     return self::$_router;
 }
예제 #2
0
 private static function router()
 {
     //ROUTER
     $router = RouterSingleton::getInstance();
     $router->setBasePath(Application::PROJECT);
     include_once 'routes.php';
     $match = $router->match();
     // call closure or throw 404 status
     if ($match && is_callable($match['target'])) {
         call_user_func_array($match['target'], $match['params']);
     } else {
         // no route was matched
         header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found');
         include_once 'src/views/404.php';
     }
     //END ROUTER
 }