PhpEngine::handleViewException()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Facade\Ignition\Views\Engines;
4
5
use Exception;
6
use Facade\Ignition\Exceptions\ViewException;
7
use Facade\Ignition\Views\Concerns\CollectsViewExceptions;
8
use Throwable;
9
10
class PhpEngine extends \Illuminate\View\Engines\PhpEngine
11
{
12
    use CollectsViewExceptions;
13
14
    /**
15
     * Get the evaluated contents of the view.
16
     *
17
     * @param  string  $path
18
     * @param  array   $data
19
     * @return string
20
     */
21
    public function get($path, array $data = [])
22
    {
23
        $this->collectViewData($path, $data);
24
25
        return parent::get($path, $data);
26
    }
27
28
    /**
29
     * Handle a view exception.
30
     *
31
     * @param  \Exception  $baseException
32
     * @param  int  $obLevel
33
     *
34
     * @return void
35
     *
36
     * @throws \Exception
37
     */
38
    protected function handleViewException(Throwable $baseException, $obLevel)
39
    {
40
        $exception = new ViewException($baseException->getMessage(), 0, 1, $baseException->getFile(), $baseException->getLine(), $baseException);
41
42
        $exception->setView($this->getCompiledViewName($baseException->getFile()));
43
        $exception->setViewData($this->getCompiledViewData($baseException->getFile()));
44
45
        parent::handleViewException($exception, $obLevel);
46
    }
47
}
48