Completed
Push — master ( 85028e...e22ffb )
by Marco
15s queued 10s
created

ComposerInstallationReflectorFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 2
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Roave\BackwardCompatibility\Factory;
6
7
use Roave\BackwardCompatibility\LocateSources\LocateSources;
8
use Roave\BetterReflection\Reflector\ClassReflector;
9
use Roave\BetterReflection\SourceLocator\Exception\InvalidDirectory;
10
use Roave\BetterReflection\SourceLocator\Exception\InvalidFileInfo;
11
use Roave\BetterReflection\SourceLocator\Type\AggregateSourceLocator;
12
use Roave\BetterReflection\SourceLocator\Type\MemoizingSourceLocator;
13
use Roave\BetterReflection\SourceLocator\Type\SourceLocator;
14
15
/**
16
 * @codeCoverageIgnore
17
 */
18
final class ComposerInstallationReflectorFactory
19
{
20
    /** @var LocateSources */
21
    private $locateSources;
22
23
    public function __construct(LocateSources $locateSources)
24
    {
25
        $this->locateSources = $locateSources;
26
    }
27
28
    /**
29
     * @throws InvalidFileInfo
30
     * @throws InvalidDirectory
31
     */
32
    public function __invoke(
33
        string $installationDirectory,
34
        SourceLocator $dependencies
35
    ) : ClassReflector {
36
        return new ClassReflector(
37
            new MemoizingSourceLocator(new AggregateSourceLocator([
38
                $this->locateSources->__invoke($installationDirectory),
39
                $dependencies,
40
            ]))
41
        );
42
    }
43
}
44