Skip to content

Commit

Permalink
Update ViewCollector.php for StringBladeCompiler
Browse files Browse the repository at this point in the history
This change is to support my StringBladeCompiler plugin.

Without the change the debugbar generates an error, "realpath () expects parameter 1 to be a valid path, object given"

This is because the path is an object when using the StringBladeCompler plugin instead of a template file path.

Thanks.
  • Loading branch information
TerrePorter committed Nov 30, 2015
1 parent 03e4e5b commit e211471
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/DataCollector/ViewCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,20 @@ public function addView(View $view)
{
$name = $view->getName();
$path = $view->getPath();
if ($path) {
$path = ltrim(str_replace(base_path(), '', realpath($path)), '/');
}

if (!is_object($path)) {
if ($path) {
$path = ltrim(str_replace(base_path(), '', realpath($path)), '/');
}

if (substr($path, -10) == '.blade.php') {
$type = 'blade';
if (substr($path, -10) == '.blade.php') {
$type = 'blade';
} else {
$type = pathinfo($path, PATHINFO_EXTENSION);
}
} else {
$type = pathinfo($path, PATHINFO_EXTENSION);
$type = get_class($view);
$path = '';
}

if (!$this->collect_data) {
Expand Down

0 comments on commit e211471

Please sign in to comment.