/** * @load * @param ReflectionMethod $reflection */ protected function _createFromReflection($reflection) { $this->_type = Method::SpiritMethod; parent::_createFromReflection($reflection); //{ Add Views if ($this->isPublic()) { $viewPath = \Path::instance()->evaluate(':' . $this->controller()->project()->name() . '.*' . $this->controller()->name() . '.view.-' . $this->name()); if (file_exists($viewPath)) { $dh = opendir($viewPath); $viewsFound = array(); while (false !== ($file = readdir($dh))) { if ($file != "." && $file != ".." && strtolower(pathinfo($file, PATHINFO_EXTENSION)) == 'php') { $viewFilePath = rtrim($viewPath, '/') . "/{$file}"; $viewsFound[$file] = $viewFilePath; $this->addView(SpiritView::create($this, pathinfo($file, PATHINFO_FILENAME))); } } closedir($dh); if (array_key_exists('view.php', $viewsFound)) { $this->setHasDefaultView(); } } } //} }
/** * @load * @param ReflectionMethod $reflection */ protected function _createFromReflection($reflection) { $this->_type = Method::ControllerMethod; parent::_createFromReflection($reflection); //{ Add Views if ($this->isPublic()) { $viewPath = \Path::instance()->evaluate(':' . $this->controller()->project()->name() . '.apps.view.+' . $this->controller()->name() . '.-' . $this->name()); if (file_exists($viewPath)) { $this->setViewDirectoryCreated(); $dh = opendir($viewPath); $viewsFound = array(); while (false !== ($file = readdir($dh))) { if ($file != "." && $file != ".." && strtolower(pathinfo($file, PATHINFO_EXTENSION)) == 'php') { $viewFilePath = rtrim($viewPath, '/') . "/{$file}"; if ($file == 'layout.php') { $this->setHasLayout(); $this->_layout = ControllerLayout::create($viewPath . '/layout.php'); } else { if ($file == 'params.php') { $this->setHasParams(); $this->_params = Params::create($viewPath . '/params.php'); } else { $viewsFound[$file] = $viewFilePath; $this->addView(ControllerView::create($this, pathinfo($file, PATHINFO_FILENAME))); } } } } closedir($dh); if (array_key_exists('view.php', $viewsFound)) { $this->setHasDefaultView(); } } } //} }