本文整理汇总了PHP中Illuminate\View\View::getPath方法的典型用法代码示例。如果您正苦于以下问题:PHP View::getPath方法的具体用法?PHP View::getPath怎么用?PHP View::getPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\View\View
的用法示例。
在下文中一共展示了View::getPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addView
/**
* Add a View instance to the Collector
*
* @param \Illuminate\View\View $view
*/
public function addView(View $view)
{
$name = $view->getName();
$path = $view->getPath();
if (!is_object($path)) {
if ($path) {
$path = ltrim(str_replace(base_path(), '', realpath($path)), '/');
}
if (substr($path, -10) == '.blade.php') {
$type = 'blade';
} else {
$type = pathinfo($path, PATHINFO_EXTENSION);
}
} else {
$type = get_class($view);
$path = '';
}
if (!$this->collect_data) {
$params = array_keys($view->getData());
} else {
$data = array();
foreach ($view->getData() as $key => $value) {
$data[$key] = $this->exporter->exportValue($value);
}
$params = $data;
}
$this->templates[] = array('name' => $path ? sprintf('%s (%s)', $name, $path) : $name, 'param_count' => count($params), 'params' => $params, 'type' => $type);
}
示例2: addView
/**
* Add a View instance to the Collector
*
* @param \Illuminate\View\View $view
*/
public function addView(View $view)
{
$name = $view->getName();
$path = $view->getPath();
if ($path) {
$path = ltrim(str_replace(base_path(), '', realpath($path)), '/');
}
if (substr($path, -10) == '.blade.php') {
$type = 'blade';
} else {
$type = pathinfo($path, PATHINFO_EXTENSION);
}
if (!$this->collect_data) {
$params = array_keys($view->getData());
} else {
$data = array();
foreach ($view->getData() as $key => $value) {
if (in_array($key, ['__env', 'app', 'errors', 'obLevel', 'currentUser'])) {
continue;
}
$data[$key] = $this->exportValue($value);
}
$params = $data;
}
$this->templates[] = array('name' => $path ? sprintf('%s (%s)', $name, $path) : $name, 'param_count' => count($params), 'params' => $params, 'type' => $type);
}
示例3:
/**
* Get the compiled path of a view.
*
* @param View $view
*
* @return string
*/
function get_compiled_path(View $view)
{
/** @type CompilerEngine $engine */
$engine = $view->getEngine();
/** @type BladeCompiler $compiler */
$compiler = $engine->getCompiler();
$path = $view->getPath();
if ($compiler->isExpired($path)) {
$compiler->compile($path);
}
$compiled = $compiler->getCompiledPath($path);
return $compiled;
}
示例4: addView
/**
* Add a View instance to the Collector
*
* @param \Illuminate\View\View $view
*/
public function addView(View $view)
{
$name = $view->getName();
$type = pathinfo($view->getPath(), PATHINFO_EXTENSION);
if (!$this->collect_data) {
$params = array_keys($view->getData());
} else {
$data = array();
foreach ($view->getData() as $key => $value) {
if (is_object($value) && method_exists($value, 'toArray')) {
$value = $value->toArray();
}
$data[$key] = $this->exporter->exportValue($value);
}
$params = $data;
}
$this->templates[] = array('name' => $name, 'param_count' => count($params), 'params' => $params, 'type' => $type);
}