Total Complexity | 6 |
Total Lines | 54 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | 1 | final class EntryPointLookupProvider implements IEntryPointLookupProvider |
|
11 | { |
||
12 | use Nette\SmartObject; |
||
13 | |||
14 | /** @var \SixtyEightPublishers\WebpackEncoreBundle\EntryPoint\IEntryPointLookup[] */ |
||
15 | private $lookups = []; |
||
16 | |||
17 | /** @var string|NULL */ |
||
18 | private $defaultName; |
||
19 | |||
20 | /** |
||
21 | * @param \SixtyEightPublishers\WebpackEncoreBundle\EntryPoint\IEntryPointLookup[] $lookups |
||
22 | * @param string|null $defaultName |
||
23 | */ |
||
24 | 1 | public function __construct(array $lookups, ?string $defaultName = NULL) |
|
25 | { |
||
26 | 1 | foreach ($lookups as $lookup) { |
|
27 | 1 | $this->add($lookup); |
|
28 | } |
||
29 | |||
30 | 1 | $this->defaultName = $defaultName; |
|
31 | 1 | } |
|
32 | |||
33 | /** |
||
34 | * @param \SixtyEightPublishers\WebpackEncoreBundle\EntryPoint\IEntryPointLookup $lookup |
||
35 | * |
||
36 | * @return void |
||
37 | */ |
||
38 | 1 | private function add(IEntryPointLookup $lookup): void |
|
39 | { |
||
40 | 1 | $this->lookups[$lookup->getBuildName()] = $lookup; |
|
41 | 1 | } |
|
42 | |||
43 | /************** interface \SixtyEightPublishers\WebpackEncoreBundle\EntryPoint\IEntryPointLookupProvider **************/ |
||
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | 1 | public function getEntryPointLookup(string $buildName = NULL): IEntryPointLookup |
|
64 | } |
||
65 | } |
||
66 |