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

PhpParser   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parse() 0 6 2
A __construct() 0 4 1
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