public function __construct($directory, $extension, $namespace = NULL) { $this->extension = $extension; $this->directory = $directory; $this->namespace = empty($namespace) ? '' : $namespace; if (($systemCache = $this->extension->getApp()->getCacheRepository('system')) != NULL && is_array($controllerClassFiles = $systemCache->get($this->directory . '::fileList'))) { } else { // Make sure all PHP files in the directory are included $controllerClassFiles = DirectoryHelper::directoryToArray($this->directory, TRUE, '.php'); if ($systemCache != NULL) { $systemCache->forever($this->directory . '::fileList', $controllerClassFiles); } } foreach ($controllerClassFiles as $controllerClassFile) { include_once $controllerClassFile; $controllerClass = ReflectionHelper::createClassName($this->namespace, basename($controllerClassFile, '.php')); $this->controllerClasses[] = $controllerClass; $controller = new $controllerClass($this->extension); $rclass = new \ReflectionClass($controller); if ($rclass->isSubclassOf('\\MABI\\ModelController')) { /** * @var $controller \MABI\ModelController */ $this->overriddenModelClasses[] = $controller->getModelClass(); } $this->controllers[] = $controller; } }
/** * todo: docs * * @param $directory string * @param $extension \MABI\Extension * @param $namespace string|null */ public function __construct($directory, $extension, $namespace = NULL) { $this->directory = $directory; $this->namespace = $namespace; $this->extension = $extension; if (($systemCache = $this->extension->getApp()->getCacheRepository('system')) != NULL && is_array($modelClassFiles = $systemCache->get($this->directory . '::fileList'))) { $this->modelClassFiles = $modelClassFiles; } else { // Make sure all PHP files in the directory are included $this->modelClassFiles = DirectoryHelper::directoryToArray($this->directory, TRUE, '.php'); if ($systemCache != NULL) { $systemCache->forever($this->directory . '::fileList', $this->modelClassFiles); } } foreach ($this->modelClassFiles as $modelClassFile) { include_once $modelClassFile; } }