Passed
Push — 1.5 ( c7c5a4...fe8795 )
by Luis
06:06
created

PhpParser::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * PHP version 7.1
4
 *
5
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
6
 */
7
8
namespace PhUml\Parser\Code;
9
10
use PhpParser\Parser;
11
use PhUml\Code\Codebase;
12
use PhUml\Parser\CodeFinder;
13
14
abstract class PhpParser
15
{
16
    /** @var Parser */
17
    private $parser;
18
19
    /** @var PhpTraverser */
20
    private $traverser;
21
22 129
    public function __construct(Parser $parser, PhpTraverser $traverser)
23
    {
24 129
        $this->parser = $parser;
25 129
        $this->traverser = $traverser;
26 129
    }
27
28 111
    public function parse(CodeFinder $finder): Codebase
29
    {
30 111
        foreach ($finder->files() as $code) {
31 108
            $this->traverser->traverse($this->parser->parse($code));
32
        }
33 111
        return $this->traverser->codebase();
34
    }
35
}
36