public function __destruct() { $this->controller = NULL; $this->params = NULL; $this->url = NULL; parent::__destruct(); }
function __construct($urlName) { parent::__construct(); if (isset(Get::get($urlName))) { require "./QW/Controllers/" . Get::get($urlName) . ".php"; } else { throw new IllegalArgumentException(); } }
public static function loadClass() { mb_internal_encoding("UTF-8"); $load = function ($class) { if (AbstractRouter::getAllDebug()) { echo 'Loading class: <b>' . $class . '</b><br>'; } // don't load Controller or Model by this //if ( preg_match( '#Controller|Model$#', $class ) ) return -2; // manual Smarty load if (preg_match('#Smarty#', $class)) { return -3; } if (strpos('Smarty', $class)) { return -1; } // parse namespace $c = explode('\\', $class); $count = count($c); $pathToFile = './' . implode('/', $c) . '.php'; $pathToDir = './' . implode('/', array_slice($c, $count - 1)); $pathToExceptions = $pathToDir . '/Exceptions.php'; if (file_exists($pathToExceptions)) { require_once $pathToExceptions; } // load class in namespace if (file_exists($pathToFile)) { require_once $pathToFile; } else { $message = 'Error from ' . self::getStaticClassName() . ': File: ' . $pathToFile . ' doesn\'t exists<br>'; //$logger = new Logger( Logger::LOG_TYPE_FILE ); //$logger->log( $message ); //self::getExecutionStack(); die($message); } return 0; }; try { spl_autoload_register($load, TRUE); } catch (\Exception $e) { echo $e->getMessage(); } }
public function __construct($message = '', $code = 0, \Exception $previous = NULL) { parent::__construct($message, $code, $previous); AbstractRouter::getGlobalLogger()->log($message); }
public function __destruct() { $this->enabledRoutes = NULL; $this->urlDelimiter = NULL; parent::__destruct(); }