本文整理汇总了PHP中Method::_createFromReflection方法的典型用法代码示例。如果您正苦于以下问题:PHP Method::_createFromReflection方法的具体用法?PHP Method::_createFromReflection怎么用?PHP Method::_createFromReflection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Method
的用法示例。
在下文中一共展示了Method::_createFromReflection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _createFromReflection
/**
* @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();
}
}
}
//}
}
示例2: _createFromReflection
/**
* @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();
}
}
}
//}
}