1 | <?php |
||
2 | /** |
||
3 | * Copyright (c) 2019. Volodymyr Hryvinskyi. All rights reserved. |
||
4 | * @author: <mailto:[email protected]> |
||
5 | * @github: <https://github.com/hryvinskyi> |
||
6 | */ |
||
7 | |||
8 | declare(strict_types=1); |
||
9 | |||
10 | namespace Hryvinskyi\DeferJs\Model\PassesValidator; |
||
11 | |||
12 | /** |
||
13 | * Class EntityList |
||
14 | */ |
||
15 | class EntityList |
||
16 | { |
||
17 | /** |
||
18 | * @var string[] |
||
19 | */ |
||
20 | private $entityTypes = []; |
||
21 | |||
22 | |||
23 | /** |
||
24 | * EntityList constructor. |
||
25 | * |
||
26 | * @param string[] $entityTypes |
||
27 | */ |
||
28 | public function __construct( |
||
29 | $entityTypes = [] |
||
30 | ) { |
||
31 | $this->entityTypes = $entityTypes; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * Retrieve list of entities |
||
36 | * |
||
37 | * @return ValidatorInterface[] |
||
38 | */ |
||
39 | public function getList(): array |
||
40 | { |
||
41 | return $this->entityTypes; |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @param string $code |
||
46 | * |
||
47 | * @return ValidatorInterface |
||
48 | */ |
||
49 | public function getEntityByCode(string $code): ValidatorInterface |
||
50 | { |
||
51 | return $this->entityTypes[$code]; |
||
0 ignored issues
–
show
|
|||
52 | } |
||
53 | } |