Completed
Pull Request — 2.x (#216)
by Akihito
09:22
created

Code   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 31
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A __toString() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ray\Compiler;
6
7
use PhpParser\Node;
8
use PhpParser\PrettyPrinter\Standard;
9
10
final class Code
11
{
12
    /**
13
     * @var bool
14
     */
15
    public $isSingleton;
16
17
    /**
18
     * @var null|IpQualifier
19
     */
20
    public $qualifiers;
21
22
    /**
23
     * @var Node
24
     */
25
    private $node;
26
27
    public function __construct(Node $node, bool $isSingleton = false, IpQualifier $qualifier = null)
28
    {
29
        $this->node = $node;
30
        $this->isSingleton = $isSingleton;
31
        $this->qualifiers = $qualifier;
32
    }
33
34
    public function __toString()
35
    {
36
        $prettyPrinter = new Standard();
37
38
        return $prettyPrinter->prettyPrintFile([$this->node]);
39
    }
40
}
41