From 3e7552909098de2e43903546c74e483dae0c3541 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Fri, 30 Sep 2022 19:46:04 +0100 Subject: [PATCH 1/7] Adds better `app.editor` support --- .../Concerns/ResolvesDumpSource.php | 42 ++++++++++ .../Foundation/Console/CliDumper.php | 7 +- src/Illuminate/Foundation/Http/HtmlDumper.php | 24 +----- tests/Foundation/Http/HtmlDumperTest.php | 82 +++++++++++++++++++ 4 files changed, 130 insertions(+), 25 deletions(-) diff --git a/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php b/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php index 6df2a979d987..64c0714b41f3 100644 --- a/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php +++ b/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php @@ -62,6 +62,48 @@ public function resolveDumpSource() return [$file, $relativeFile, $line]; } + /** + * Resolves the source href, if possible. + * + * @param string $file + * @param int|null $line + * @return string|null + */ + protected function resolveSourceHref($file, $line) + { + try { + $editor = config('app.editor'); + } catch (Throwable $e) { + // .. + } + + if (! isset($editor)) { + return; + } + + $href = is_array($editor) ? ($editor['href'] ?? null) : $editor; + + if (empty($href)) { + return; + } + + if ($basePath = $editor['base_path'] ?? false) { + $file = str_replace($this->basePath, $basePath, $file); + } + + if (! str_contains($href, '://')) { + $href = sprintf('%s://open?file={file}&line={line}', $href); + } + + $href = str_replace( + ['{file}', '{line}'], + [$file, is_null($line) ? 1 : $line], + $href, + ); + + return $href; + } + /** * Determine if the given file is a view compiled. * diff --git a/src/Illuminate/Foundation/Console/CliDumper.php b/src/Illuminate/Foundation/Console/CliDumper.php index a3c107f09438..beed2f2af9f4 100644 --- a/src/Illuminate/Foundation/Console/CliDumper.php +++ b/src/Illuminate/Foundation/Console/CliDumper.php @@ -114,10 +114,11 @@ protected function getDumpSourceContent() [$file, $relativeFile, $line] = $dumpSource; + $href = $this->resolveSourceHref($file, $line); + return sprintf( - ' // %s%s', - $file, - is_null($line) ? '' : "#L$line", + ' // %s%s', + is_null($href) ? '' : ";href=$href", $relativeFile, is_null($line) ? '' : ":$line" ); diff --git a/src/Illuminate/Foundation/Http/HtmlDumper.php b/src/Illuminate/Foundation/Http/HtmlDumper.php index b9074292c50d..6f8ca5e193c4 100644 --- a/src/Illuminate/Foundation/Http/HtmlDumper.php +++ b/src/Illuminate/Foundation/Http/HtmlDumper.php @@ -132,30 +132,10 @@ protected function getDumpSourceContent() $source = sprintf('%s%s', $relativeFile, is_null($line) ? '' : ":$line"); - if ($editor = $this->editor()) { - $source = sprintf( - '%s', - $editor, - $file, - is_null($line) ? '' : "&line=$line", - $source, - ); + if ($href = $this->resolveSourceHref($file, $line)) { + $source = sprintf('%s', $href, $source); } return sprintf(' // %s', $source); } - - /** - * Get the application editor, if applicable. - * - * @return string|null - */ - protected function editor() - { - try { - return config('app.editor'); - } catch (Throwable $e) { - // ... - } - } } diff --git a/tests/Foundation/Http/HtmlDumperTest.php b/tests/Foundation/Http/HtmlDumperTest.php index 6179db28c448..8e84047682a3 100644 --- a/tests/Foundation/Http/HtmlDumperTest.php +++ b/tests/Foundation/Http/HtmlDumperTest.php @@ -2,6 +2,8 @@ namespace Illuminate\Tests\Foundation\Http; +use Illuminate\Config\Repository; +use Illuminate\Container\Container; use Illuminate\Foundation\Http\HtmlDumper; use PHPUnit\Framework\TestCase; use ReflectionClass; @@ -11,6 +13,8 @@ class HtmlDumperTest extends TestCase { + protected $app; + protected function setUp(): void { HtmlDumper::resolveDumpSourceUsing(function () { @@ -20,6 +24,8 @@ protected function setUp(): void 18, ]; }); + + $this->app = Container::getInstance(); } public function testString() @@ -184,6 +190,81 @@ public function testUnresolvableLine() $this->assertStringContainsString($expected, $output); } + public function testHref() + { + $dumper = new HtmlDumper( + '/my-work-directory', + '/my-work-directory/storage/framework/views' + ); + + // Failure... + $href = (fn () => $this->href( + '/my-work-directory/app/my-file', + 10, + ))->call($dumper); + $this->assertNull($href); + + $config = new Repository(); + $this->app->instance('config', $config); + $href = fn () => (fn () => $this->href( + '/my-work-directory/app/my-file', + 10, + ))->call($dumper); + + // Empty... + $this->assertNull($href()); + + // When editor is provided... + $config->set('app.editor', 'phpstorm'); + $this->assertSame( + 'phpstorm://open?file=/my-work-directory/app/my-file&line=10', $href() + ); + + // When href is provided... + $config->set('app.editor', 'vscode://open?file={file}&line={line}'); + $this->assertSame( + 'vscode://open?file=/my-work-directory/app/my-file&line=10', $href() + ); + + // When editoe is provided on array format... + $config->set('app.editor', ['href' => 'phpstorm']); + $this->assertSame( + 'phpstorm://open?file=/my-work-directory/app/my-file&line=10', $href() + ); + + // When editor and base path is provided on array format... + $config->set('app.editor', ['href' => 'phpstorm', 'base_path' => '/my-docker-work-directory']); + $this->assertSame( + 'phpstorm://open?file=/my-docker-work-directory/app/my-file&line=10', $href()); + + // When base path is provided on array format... + $config->set('app.editor', ['base_path' => '/my-docker-work-directory']); + $this->assertNull($href()); + + // When href is provided on array format... + $config->set('app.editor', ['href' => 'vscode://open?file={file}&line={line}']); + $this->assertSame( + 'vscode://open?file=/my-work-directory/app/my-file&line=10', $href() + ); + + // Array with href and base path + $config->set('app.editor', ['href' => 'vscode://open?file={file}&line={line}', 'base_path' => '/my-docker-work-directory']); + $this->assertSame( + 'vscode://open?file=/my-docker-work-directory/app/my-file&line=10', $href() + ); + + // Missing line + $href = (fn () => $this->href( + '/my-work-directory/app/my-file', + null, + ))->call($dumper); + $config->set('app.editor', ['href' => 'vscode', 'base_path' => '/my-docker-work-directory']); + $this->assertSame( + 'vscode://open?file=/my-docker-work-directory/app/my-file&line=1', + $href, + ); + } + protected function dump($value) { $outputFile = stream_get_meta_data(tmpfile())['uri']; @@ -205,5 +286,6 @@ protected function dump($value) protected function tearDown(): void { HtmlDumper::resolveDumpSourceUsing(null); + Container::setInstance(null); } } From a0a27c29bf8d92b8b4b2612175ee59f102c673c7 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Fri, 30 Sep 2022 18:46:53 +0000 Subject: [PATCH 2/7] Apply fixes from StyleCI --- src/Illuminate/Foundation/Http/HtmlDumper.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Illuminate/Foundation/Http/HtmlDumper.php b/src/Illuminate/Foundation/Http/HtmlDumper.php index 6f8ca5e193c4..2df09013fe65 100644 --- a/src/Illuminate/Foundation/Http/HtmlDumper.php +++ b/src/Illuminate/Foundation/Http/HtmlDumper.php @@ -8,7 +8,6 @@ use Symfony\Component\VarDumper\Cloner\VarCloner; use Symfony\Component\VarDumper\Dumper\HtmlDumper as BaseHtmlDumper; use Symfony\Component\VarDumper\VarDumper; -use Throwable; class HtmlDumper extends BaseHtmlDumper { From 8ba9a1c72a08dc862c96284d8ccda9983a6839c9 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Fri, 30 Sep 2022 19:51:26 +0100 Subject: [PATCH 3/7] Adds missing class --- src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php b/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php index 64c0714b41f3..fe558584fdaf 100644 --- a/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php +++ b/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php @@ -2,6 +2,8 @@ namespace Illuminate\Foundation\Concerns; +use Throwable; + trait ResolvesDumpSource { /** From c4500ebc6283cc0ceea8f8a2ca9c3af00649c89e Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Fri, 30 Sep 2022 20:35:52 +0100 Subject: [PATCH 4/7] Fixes tests --- tests/Foundation/Http/HtmlDumperTest.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/Foundation/Http/HtmlDumperTest.php b/tests/Foundation/Http/HtmlDumperTest.php index 8e84047682a3..5dd6d1c5be9f 100644 --- a/tests/Foundation/Http/HtmlDumperTest.php +++ b/tests/Foundation/Http/HtmlDumperTest.php @@ -198,7 +198,7 @@ public function testHref() ); // Failure... - $href = (fn () => $this->href( + $href = (fn () => $this->resolveSourceHref( '/my-work-directory/app/my-file', 10, ))->call($dumper); @@ -206,55 +206,55 @@ public function testHref() $config = new Repository(); $this->app->instance('config', $config); - $href = fn () => (fn () => $this->href( + $resolveSourceHref = fn () => (fn () => $this->resolveSourceHref( '/my-work-directory/app/my-file', 10, ))->call($dumper); // Empty... - $this->assertNull($href()); + $this->assertNull($resolveSourceHref()); // When editor is provided... $config->set('app.editor', 'phpstorm'); $this->assertSame( - 'phpstorm://open?file=/my-work-directory/app/my-file&line=10', $href() + 'phpstorm://open?file=/my-work-directory/app/my-file&line=10', $resolveSourceHref() ); // When href is provided... $config->set('app.editor', 'vscode://open?file={file}&line={line}'); $this->assertSame( - 'vscode://open?file=/my-work-directory/app/my-file&line=10', $href() + 'vscode://open?file=/my-work-directory/app/my-file&line=10', $resolveSourceHref() ); // When editoe is provided on array format... $config->set('app.editor', ['href' => 'phpstorm']); $this->assertSame( - 'phpstorm://open?file=/my-work-directory/app/my-file&line=10', $href() + 'phpstorm://open?file=/my-work-directory/app/my-file&line=10', $resolveSourceHref() ); // When editor and base path is provided on array format... $config->set('app.editor', ['href' => 'phpstorm', 'base_path' => '/my-docker-work-directory']); $this->assertSame( - 'phpstorm://open?file=/my-docker-work-directory/app/my-file&line=10', $href()); + 'phpstorm://open?file=/my-docker-work-directory/app/my-file&line=10', $resolveSourceHref()); // When base path is provided on array format... $config->set('app.editor', ['base_path' => '/my-docker-work-directory']); - $this->assertNull($href()); + $this->assertNull($resolveSourceHref()); // When href is provided on array format... $config->set('app.editor', ['href' => 'vscode://open?file={file}&line={line}']); $this->assertSame( - 'vscode://open?file=/my-work-directory/app/my-file&line=10', $href() + 'vscode://open?file=/my-work-directory/app/my-file&line=10', $resolveSourceHref() ); // Array with href and base path $config->set('app.editor', ['href' => 'vscode://open?file={file}&line={line}', 'base_path' => '/my-docker-work-directory']); $this->assertSame( - 'vscode://open?file=/my-docker-work-directory/app/my-file&line=10', $href() + 'vscode://open?file=/my-docker-work-directory/app/my-file&line=10', $resolveSourceHref() ); // Missing line - $href = (fn () => $this->href( + $href = (fn () => $this->resolveSourceHref( '/my-work-directory/app/my-file', null, ))->call($dumper); From 6bc716abce6f954f7869c1abe20fbbf67e6fee1b Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Fri, 30 Sep 2022 20:52:31 +0100 Subject: [PATCH 5/7] Uses `name` instead of `href` --- .../Concerns/ResolvesDumpSource.php | 12 +++------- tests/Foundation/Http/HtmlDumperTest.php | 24 ++++++------------- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php b/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php index fe558584fdaf..01306ce7b699 100644 --- a/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php +++ b/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php @@ -83,20 +83,14 @@ protected function resolveSourceHref($file, $line) return; } - $href = is_array($editor) ? ($editor['href'] ?? null) : $editor; - - if (empty($href)) { - return; - } + $href = is_array($editor) && isset($editor['href']) + ? $editor['href'] + : sprintf('%s://open?file={file}&line={line}', $editor['name'] ?? $editor); if ($basePath = $editor['base_path'] ?? false) { $file = str_replace($this->basePath, $basePath, $file); } - if (! str_contains($href, '://')) { - $href = sprintf('%s://open?file={file}&line={line}', $href); - } - $href = str_replace( ['{file}', '{line}'], [$file, is_null($line) ? 1 : $line], diff --git a/tests/Foundation/Http/HtmlDumperTest.php b/tests/Foundation/Http/HtmlDumperTest.php index 5dd6d1c5be9f..14f9622f49f3 100644 --- a/tests/Foundation/Http/HtmlDumperTest.php +++ b/tests/Foundation/Http/HtmlDumperTest.php @@ -214,40 +214,30 @@ public function testHref() // Empty... $this->assertNull($resolveSourceHref()); - // When editor is provided... + // When editor name is provided... $config->set('app.editor', 'phpstorm'); $this->assertSame( 'phpstorm://open?file=/my-work-directory/app/my-file&line=10', $resolveSourceHref() ); - // When href is provided... - $config->set('app.editor', 'vscode://open?file={file}&line={line}'); - $this->assertSame( - 'vscode://open?file=/my-work-directory/app/my-file&line=10', $resolveSourceHref() - ); - - // When editoe is provided on array format... - $config->set('app.editor', ['href' => 'phpstorm']); + // When editor name is provided on array format... + $config->set('app.editor', ['name' => 'phpstorm']); $this->assertSame( 'phpstorm://open?file=/my-work-directory/app/my-file&line=10', $resolveSourceHref() ); - // When editor and base path is provided on array format... - $config->set('app.editor', ['href' => 'phpstorm', 'base_path' => '/my-docker-work-directory']); + // When editor name and base path is provided on array format... + $config->set('app.editor', ['name' => 'phpstorm', 'base_path' => '/my-docker-work-directory']); $this->assertSame( 'phpstorm://open?file=/my-docker-work-directory/app/my-file&line=10', $resolveSourceHref()); - // When base path is provided on array format... - $config->set('app.editor', ['base_path' => '/my-docker-work-directory']); - $this->assertNull($resolveSourceHref()); - // When href is provided on array format... $config->set('app.editor', ['href' => 'vscode://open?file={file}&line={line}']); $this->assertSame( 'vscode://open?file=/my-work-directory/app/my-file&line=10', $resolveSourceHref() ); - // Array with href and base path + // When href and base path is provided on array format... $config->set('app.editor', ['href' => 'vscode://open?file={file}&line={line}', 'base_path' => '/my-docker-work-directory']); $this->assertSame( 'vscode://open?file=/my-docker-work-directory/app/my-file&line=10', $resolveSourceHref() @@ -258,7 +248,7 @@ public function testHref() '/my-work-directory/app/my-file', null, ))->call($dumper); - $config->set('app.editor', ['href' => 'vscode', 'base_path' => '/my-docker-work-directory']); + $config->set('app.editor', ['name' => 'vscode', 'base_path' => '/my-docker-work-directory']); $this->assertSame( 'vscode://open?file=/my-docker-work-directory/app/my-file&line=1', $href, From c0b6cd3a2f5dfee45eafa88bae7c7858269a3dba Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Mon, 3 Oct 2022 11:20:09 +0100 Subject: [PATCH 6/7] Adds most common edtor's href format --- .../Concerns/ResolvesDumpSource.php | 25 ++++++++++++++++++- tests/Foundation/Http/HtmlDumperTest.php | 9 +++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php b/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php index 01306ce7b699..5608b0ff11c6 100644 --- a/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php +++ b/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php @@ -6,6 +6,29 @@ trait ResolvesDumpSource { + /** + * The most common editor's href format. + * + * @var array + */ + protected $editorsHref = [ + 'sublime' => 'subl://open?url=file://{file}&line={line}', + 'textmate' => 'txmt://open?url=file://{file}&line={line}', + 'emacs' => 'emacs://open?url=file://{file}&line={line}', + 'macvim' => 'mvim://open/?url=file://{file}&line={line}', + 'phpstorm' => 'phpstorm://open?file={file}&line={line}', + 'idea' => 'idea://open?file={file}&line={line}', + 'vscode' => 'vscode://file/{file}:{line}', + 'vscode-insiders' => 'vscode-insiders://file/{file}:{line}', + 'vscode-remote' => 'vscode://vscode-remote/{file}:{line}', + 'vscode-insiders-remote' => 'vscode-insiders://vscode-remote/{file}:{line}', + 'vscodium' => 'vscodium://file/{file}:{line}', + 'atom' => 'atom://core/open/file?filename={file}&line={line}', + 'nova' => 'nova://core/open/file?filename={file}&line={line}', + 'netbeans' => 'netbeans://open/?f={file}:{line}', + 'xdebug' => 'xdebug://{file}@{line}', + ]; + /** * The source resolver. * @@ -85,7 +108,7 @@ protected function resolveSourceHref($file, $line) $href = is_array($editor) && isset($editor['href']) ? $editor['href'] - : sprintf('%s://open?file={file}&line={line}', $editor['name'] ?? $editor); + : ($this->editorsHref[$editor['name'] ?? $editor] ?? sprintf('%s://open?file={file}&line={line}', $editor['name'] ?? $editor)); if ($basePath = $editor['base_path'] ?? false) { $file = str_replace($this->basePath, $basePath, $file); diff --git a/tests/Foundation/Http/HtmlDumperTest.php b/tests/Foundation/Http/HtmlDumperTest.php index 14f9622f49f3..26dbcebf0b94 100644 --- a/tests/Foundation/Http/HtmlDumperTest.php +++ b/tests/Foundation/Http/HtmlDumperTest.php @@ -243,14 +243,19 @@ public function testHref() 'vscode://open?file=/my-docker-work-directory/app/my-file&line=10', $resolveSourceHref() ); + // When editor name is provided... + $config->set('app.editor', 'sublime'); + $this->assertSame('subl://open?url=file:///my-work-directory/app/my-file&line=10', $resolveSourceHref()); + // Missing line + $config->set('app.editor', ['name' => 'vscode', 'base_path' => '/my-docker-work-directory']); + $href = (fn () => $this->resolveSourceHref( '/my-work-directory/app/my-file', null, ))->call($dumper); - $config->set('app.editor', ['name' => 'vscode', 'base_path' => '/my-docker-work-directory']); $this->assertSame( - 'vscode://open?file=/my-docker-work-directory/app/my-file&line=1', + 'vscode://file//my-docker-work-directory/app/my-file:1', $href, ); } From 6160a0ef89bd37bc5ac32fbc1117b6b020687318 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 3 Oct 2022 15:26:38 -0500 Subject: [PATCH 7/7] formatting --- .../Concerns/ResolvesDumpSource.php | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php b/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php index 5608b0ff11c6..92d127229b04 100644 --- a/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php +++ b/src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php @@ -7,25 +7,25 @@ trait ResolvesDumpSource { /** - * The most common editor's href format. + * All of the href formats for common editors. * * @var array */ - protected $editorsHref = [ - 'sublime' => 'subl://open?url=file://{file}&line={line}', - 'textmate' => 'txmt://open?url=file://{file}&line={line}', + protected $editorHrefs = [ + 'atom' => 'atom://core/open/file?filename={file}&line={line}', 'emacs' => 'emacs://open?url=file://{file}&line={line}', + 'idea' => 'idea://open?file={file}&line={line}', 'macvim' => 'mvim://open/?url=file://{file}&line={line}', + 'netbeans' => 'netbeans://open/?f={file}:{line}', + 'nova' => 'nova://core/open/file?filename={file}&line={line}', 'phpstorm' => 'phpstorm://open?file={file}&line={line}', - 'idea' => 'idea://open?file={file}&line={line}', + 'sublime' => 'subl://open?url=file://{file}&line={line}', + 'textmate' => 'txmt://open?url=file://{file}&line={line}', 'vscode' => 'vscode://file/{file}:{line}', 'vscode-insiders' => 'vscode-insiders://file/{file}:{line}', - 'vscode-remote' => 'vscode://vscode-remote/{file}:{line}', 'vscode-insiders-remote' => 'vscode-insiders://vscode-remote/{file}:{line}', + 'vscode-remote' => 'vscode://vscode-remote/{file}:{line}', 'vscodium' => 'vscodium://file/{file}:{line}', - 'atom' => 'atom://core/open/file?filename={file}&line={line}', - 'nova' => 'nova://core/open/file?filename={file}&line={line}', - 'netbeans' => 'netbeans://open/?f={file}:{line}', 'xdebug' => 'xdebug://{file}@{line}', ]; @@ -88,7 +88,35 @@ public function resolveDumpSource() } /** - * Resolves the source href, if possible. + * Determine if the given file is a view compiled. + * + * @param string $file + * @return bool + */ + protected function isCompiledViewFile($file) + { + return str_starts_with($file, $this->compiledViewPath); + } + + /** + * Get the original view compiled file by the given compiled file. + * + * @param string $file + * @return string + */ + protected function getOriginalFileForCompiledView($file) + { + preg_match('/\/\*\*PATH\s(.*)\sENDPATH/', file_get_contents($file), $matches); + + if (isset($matches[1])) { + $file = $matches[1]; + } + + return $file; + } + + /** + * Resolve the source href, if possible. * * @param string $file * @param int|null $line @@ -108,7 +136,7 @@ protected function resolveSourceHref($file, $line) $href = is_array($editor) && isset($editor['href']) ? $editor['href'] - : ($this->editorsHref[$editor['name'] ?? $editor] ?? sprintf('%s://open?file={file}&line={line}', $editor['name'] ?? $editor)); + : ($this->editorHrefs[$editor['name'] ?? $editor] ?? sprintf('%s://open?file={file}&line={line}', $editor['name'] ?? $editor)); if ($basePath = $editor['base_path'] ?? false) { $file = str_replace($this->basePath, $basePath, $file); @@ -123,34 +151,6 @@ protected function resolveSourceHref($file, $line) return $href; } - /** - * Determine if the given file is a view compiled. - * - * @param string $file - * @return bool - */ - protected function isCompiledViewFile($file) - { - return str_starts_with($file, $this->compiledViewPath); - } - - /** - * Get the original view compiled file by the given compiled file. - * - * @param string $file - * @return string - */ - protected function getOriginalFileForCompiledView($file) - { - preg_match('/\/\*\*PATH\s(.*)\sENDPATH/', file_get_contents($file), $matches); - - if (isset($matches[1])) { - $file = $matches[1]; - } - - return $file; - } - /** * Set the resolver that resolves the source of the dump call. *