Passed
Pull Request — master (#993)
by Maxim
20:44 queued 10:42
created

CompileException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 23
ccs 4
cts 8
cp 0.5
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUserTrace() 0 3 1
A getUserTrace() 0 3 1
A __construct() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Views\Exception;
6
7
class CompileException extends EngineException
8
{
9
    private array $userTrace = [];
10
11 2
    public function __construct(\Throwable $previous = null)
12
    {
13 2
        parent::__construct((string) $previous?->getMessage(), (int) ($previous?->getCode() ?? 0), $previous);
14
15 2
        $this->file = (string) $previous?->getFile();
16 2
        $this->line = (int) $previous?->getLine();
17
    }
18
19
    /**
20
     * Set user trace pointing to the location of error in view templates.
21
     */
22
    public function setUserTrace(array $trace): void
23
    {
24
        $this->userTrace = $trace;
25
    }
26
27
    public function getUserTrace(): array
28
    {
29
        return $this->userTrace;
30
    }
31
}
32