ResolveDependencyException   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 8
c 2
b 0
f 1
dl 0
loc 31
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getNodeType() 0 3 1
A getNodeLine() 0 3 1
A nodeToString() 0 3 1
A __toString() 0 3 1
A __construct() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace DependencyAnalyzer\Exceptions;
5
6
use PhpParser\Node;
7
8
class ResolveDependencyException extends RuntimeException
9
{
10
    /**
11
     * @var Node
12
     */
13
    private $node;
14
15
    public function __construct(Node $node, $message = '', $code = 0, \Throwable $previous = null)
16
    {
17
        parent::__construct($message, $code, $previous);
18
        $this->node = $node;
19
    }
20
21
    public function getNodeLine()
22
    {
23
        return $this->node->getLine();
24
    }
25
26
    public function getNodeType()
27
    {
28
        return $this->node->getType();
29
    }
30
31
    public function __toString(): string
32
    {
33
        return parent::__toString() . ' ' . $this->nodeToString();
34
    }
35
36
    protected function nodeToString(): string
37
    {
38
        return "type: {$this->getNodeType()}, line: {$this->getNodeLine()}";
39
    }
40
}
41