/** * Get controller * * @return \XLite\Controller\AController */ public static function getController() { if (!isset(static::$controller)) { $class = static::getControllerClass(); if (!\XLite\Core\Operator::isClassExists($class)) { \XLite\Core\Request::getInstance()->target = static::TARGET_DEFAULT; \XLite\Logger::getInstance()->log('Controller class ' . $class . ' not found!', LOG_ERR); \XLite\Core\Request::getInstance()->target = static::TARGET_404; $class = static::getControllerClass(); } static::$controller = new $class(\XLite\Core\Request::getInstance()->getData()); static::$controller->init(); } return static::$controller; }
/** * Get controller * * @return \XLite\Controller\AController */ public static function getController() { if (!isset(static::$controller)) { $class = static::getControllerClass(); if (!$class) { \XLite\Core\Request::getInstance()->target = static::TARGET_DEFAULT; \XLite\Logger::logCustom('access', 'Controller class ' . $class . ' not found!'); \XLite\Core\Request::getInstance()->target = static::TARGET_404; $class = static::getControllerClass(); } static::$controller = new $class(\XLite\Core\Request::getInstance()->getData()); static::$controller->init(); } return static::$controller; }
/** * Get controller * * @return \XLite\Controller\AController */ public static function getController() { if (null === static::$controller) { $class = static::getControllerClass(); if (!$class) { \XLite\Core\Request::getInstance()->target = static::TARGET_DEFAULT; \XLite\Logger::logCustom('access', 'Controller class ' . $class . ' not found!'); \XLite\Core\Request::getInstance()->target = static::TARGET_404; $class = static::getControllerClass(); } if (!\XLite\Core\Request::getInstance()->isCLI() && \XLite::getInstance()->getRequestedScript() !== \XLite::getInstance()->getExpectedScript() && \XLite::getInstance()->getRequestedScript() !== \XLite::getInstance()->getExpectedScript(true)) { \XLite\Core\Request::getInstance()->target = static::TARGET_404; $class = static::getControllerClass(); } static::$controller = new $class(\XLite\Core\Request::getInstance()->getData()); static::$controller->init(); } return static::$controller; }