1 | <?php |
||
25 | final class SourcesRegistry implements SourcesRegistryInterface |
||
26 | { |
||
27 | /** |
||
28 | * @var SourceInterface[] |
||
29 | */ |
||
30 | private $sources; |
||
31 | |||
32 | /** |
||
33 | * SourcesRegistry constructor. |
||
34 | * |
||
35 | * @param SourceInterface[] $sources |
||
36 | */ |
||
37 | 18 | public function __construct(array $sources = array()) |
|
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | 5 | public function add(SourceInterface $source) |
|
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | 5 | public function has($name) |
|
65 | |||
66 | /** |
||
67 | * {@inheritdoc} |
||
68 | * |
||
69 | * @throws SourceNotAvailableException |
||
70 | */ |
||
71 | 2 | public function get($name) |
|
79 | |||
80 | /** |
||
81 | * {@inheritdoc} |
||
82 | */ |
||
83 | 2 | public function all(array $filter = array()) |
|
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | 1 | public function getIterator() |
|
99 | |||
100 | /** |
||
101 | * Filter sources. |
||
102 | * |
||
103 | * Available filter criteria: |
||
104 | * * name: string |
||
105 | * * names: string[] |
||
106 | * |
||
107 | * @param SourceInterface[] $sources Sources to filter. |
||
108 | * @param array $filters Filter criteria. |
||
109 | * |
||
110 | * @return SourceInterface[] |
||
111 | */ |
||
112 | 1 | private function filter($sources, array $filters = array()) |
|
125 | } |
||
126 |