Passed
Push — master ( d3a94c...76e109 )
by Valentin
05:50
created

Extractor   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A extract() 0 11 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Cycle\ORM\Promise\Declaration;
5
6
use Cycle\ORM\Promise\Traverser;
7
8
class Extractor
9
{
10
    /** @var Traverser */
11
    private $traverser;
12
13
    public function __construct(Traverser $traverser)
14
    {
15
        $this->traverser = $traverser;
16
    }
17
18
    public function extract(string $class): Declaration
19
    {
20
        $class = new \ReflectionClass($class);
21
22
        $properties = new Visitor\LocateProperties();
23
        $methods = new Visitor\LocateMethodsToBeProxied();
24
25
        $this->traverser->traverseFilename($class->getFileName(), $properties, $methods);
26
27
        return Declaration::create($properties->getProperties(), $methods->getMethods(), !empty($class->getConstructor()));
28
    }
29
}