Completed
Push — master ( c7f0ae...412313 )
by James
9s
created

DirectoryReflectorFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 8 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Roave\ApiCompare\Factory;
5
6
use Roave\BetterReflection\BetterReflection;
7
use Roave\BetterReflection\Reflector\ClassReflector;
8
use Roave\BetterReflection\SourceLocator\Type\AggregateSourceLocator;
9
use Roave\BetterReflection\SourceLocator\Type\DirectoriesSourceLocator;
10
use Roave\BetterReflection\SourceLocator\Type\EvaledCodeSourceLocator;
11
use Roave\BetterReflection\SourceLocator\Type\PhpInternalSourceLocator;
12
13
/**
14
 * @codeCoverageIgnore
15
 */
16
final class DirectoryReflectorFactory
17
{
18
    public function __invoke(string $directory): ClassReflector
19
    {
20
        $astLocator = (new BetterReflection())->astLocator();
21
        return new ClassReflector(
22
            new AggregateSourceLocator([
23
                new PhpInternalSourceLocator($astLocator),
24
                new EvaledCodeSourceLocator($astLocator),
25
                new DirectoriesSourceLocator([$directory], $astLocator),
26
            ])
27
        );
28
    }
29
}
30