/** * 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); }
/** * 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); }
/** * 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; }
/** * 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); }