Completed
Push — refactor ( 1ac315 )
by Akihito
05:56
created

Code::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 3
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
    /** @var bool */
13
    public $isSingleton;
14
15
    /** @var IpQualifier|null */
16
    public $qualifiers;
17
18
    /** @var Node */
19
    private $node;
20
21
    public function __construct(Node $node, bool $isSingleton = false, ?IpQualifier $qualifier = null)
22
    {
23
        $this->node = $node;
24
        $this->isSingleton = $isSingleton;
25
        $this->qualifiers = $qualifier;
26
    }
27
28
    public function __toString(): string
29
    {
30
        $prettyPrinter = new Standard();
31
32
        return $prettyPrinter->prettyPrintFile([$this->node]);
33
    }
34
}
35