Passed
Pull Request — master (#68)
by Björn
03:42
created

FileAST   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 37
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getFile() 0 3 1
A __construct() 0 4 1
A getAst() 0 3 1
1
<?php
2
3
namespace ComposerRequireChecker\ASTLocator;
4
5
use PhpParser\Node;
6
7
class FileAST
8
{
9
    /**
10
     * @var string
11
     */
12
    private $file;
13
14
    /**
15
     * @var array
16
     */
17
    private $ast;
18
19
    /**
20
     * @param string $file
21
     * @param array|null $ast
22
     *
23
     */
24 1
    public function __construct(string $file, ?array $ast)
25
    {
26 1
        $this->file = $file;
27 1
        $this->ast = $ast ?? [];
28 1
    }
29
30
    /**
31
     * @return string
32
     */
33 1
    public function getFile(): string
34
    {
35 1
        return $this->file;
36
    }
37
38
    /**
39
     * @return Node[]
40
     */
41 1
    public function getAst(): array
42
    {
43 1
        return $this->ast;
44
    }
45
}
46