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

Code   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

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
    /** @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