Completed
Push — nln-php7 ( 311875...6680df )
by Nicolas
11:20
created

ExternalParser::parseLine()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 10
cts 10
cp 1
rs 9.7333
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Karma\Configuration\Parser;
6
7
use Karma\Configuration\Parser;
8
9
class ExternalParser extends AbstractSectionParser
10
{
11
    private Parser
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
12
        $parser;
13
14
    private array
15
        $variables,
16
        $filesStatus;
17
18 280
    public function __construct(Parser $parser)
19
    {
20 280
        parent::__construct();
21
22 280
        $this->parser = $parser;
23 280
        $this->variables = [];
24 280
        $this->filesStatus = [];
25 280
    }
26
27 209
    public function parseLine(string $line): void
28
    {
29 209
        $file = trim($line);
30
31 209
        $found = false;
32 209
        if($this->parser->getFileSystem()->has($file))
33
        {
34 16
            $found = true;
35 16
            $this->variables = $this->parser->parse($file);
36
        }
37
38 209
        $this->filesStatus[$file] = [
39 209
            'found' => $found,
40 209
            'referencedFrom' => $this->currentFilePath,
41
        ];
42 209
    }
43
44 184
    public function getExternalVariables(): array
45
    {
46 184
        return $this->variables;
47
    }
48
49 246
    public function getExternalFilesStatus(): array
50
    {
51 246
        return $this->filesStatus;
52
    }
53
}
54