Completed
Push — 57-formatter-per-extension ( 73b3c8 )
by Nicolas
40:17 queued 36:16
created

ExternalParser::getExternalVariables()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Karma\Configuration\Parser;
4
5
use Karma\Configuration\Parser;
6
7
class ExternalParser extends AbstractSectionParser
8
{
9
    private
10
        $parser,
0 ignored issues
show
Coding Style introduced by
It is generally advisable to only define one property per statement.

Only declaring a single property per statement allows you to later on add doc comments more easily.

It is also recommended by PSR2, so it is a common style that many people expect.

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