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

RenderException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUserTrace() 0 3 1
A getUserTrace() 0 3 1
A __construct() 0 5 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 RenderException extends ViewException
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
        $this->file = $previous->getFile();
26
        $this->line = $previous->getLine();
27
    }
28
29
    /**
30
     * Set user trace pointing to the location of error in view templates.
31
     *
32
     * @param array $trace
33
     */
34
    public function setUserTrace(array $trace): void
35
    {
36
        $this->userTrace = $trace;
37
    }
38
39
    /**
40
     * @return array
41
     */
42
    public function getUserTrace(): array
43
    {
44
        return $this->userTrace;
45
    }
46
}
47