Passed
Push — master ( 72c793...7f699f )
by Kirill
03:22
created

CompileException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 32
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A setUserTrace() 0 3 1
A getUserTrace() 0 3 1
1
<?php
2
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Anton Titov (Wolfy-J)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\Views\Exception;
13
14
class CompileException extends EngineException
15
{
16
    /** @var array */
17
    private $userTrace = [];
18
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function __construct(\Throwable $previous = null)
23
    {
24
        parent::__construct($previous->getMessage(), $previous->getCode(), $previous);
0 ignored issues
show
Bug introduced by
The method getMessage() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        parent::__construct($previous->/** @scrutinizer ignore-call */ getMessage(), $previous->getCode(), $previous);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
25
26
        $this->file = $previous->getFile();
27
        $this->line = $previous->getLine();
28
    }
29
30
    /**
31
     * Set user trace pointing to the location of error in view templates.
32
     *
33
     * @param array $trace
34
     */
35
    public function setUserTrace(array $trace): void
36
    {
37
        $this->userTrace = $trace;
38
    }
39
40
    /**
41
     * @return array
42
     */
43
    public function getUserTrace(): array
44
    {
45
        return $this->userTrace;
46
    }
47
}
48