Total Complexity | 9 |
Total Lines | 80 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
15 | class Services implements Countable |
||
16 | { |
||
17 | /** |
||
18 | * @var array |
||
19 | */ |
||
20 | private $array; |
||
21 | |||
22 | /** |
||
23 | * @var array|Service[] |
||
24 | */ |
||
25 | private $services = array(); |
||
26 | |||
27 | /** |
||
28 | * Services constructor. |
||
29 | * |
||
30 | * @param array $array |
||
31 | */ |
||
32 | 3 | public function __construct(array $array) |
|
37 | 2 | } |
|
38 | |||
39 | /** |
||
40 | * @param string $serviceName |
||
41 | * |
||
42 | * @return null|Service |
||
43 | */ |
||
44 | 1 | public function getByName($serviceName) |
|
45 | { |
||
46 | 1 | return isset($this->services[$serviceName]) ? $this->services[$serviceName] : null; |
|
47 | } |
||
48 | |||
49 | /** |
||
50 | * get array of services by names |
||
51 | * |
||
52 | * if a service is not found it will not be returned |
||
53 | * |
||
54 | * @param string[] $serviceNames names of services to obtain |
||
55 | * |
||
56 | * @return Service[] |
||
57 | */ |
||
58 | 1 | public function getByNames(array $serviceNames) |
|
61 | } |
||
62 | |||
63 | /** |
||
64 | * @return int |
||
65 | */ |
||
66 | 1 | public function count() |
|
67 | { |
||
68 | 1 | return count($this->services); |
|
69 | } |
||
70 | |||
71 | /** |
||
72 | * @param array $array |
||
73 | * |
||
74 | * @return void |
||
75 | */ |
||
76 | 3 | private function parseServices(array $array) |
|
83 | } |
||
84 | 2 | } |
|
85 | |||
86 | /** |
||
87 | * @param string $name |
||
88 | * @param array $service |
||
89 | * |
||
90 | * @return Service |
||
91 | */ |
||
92 | 1 | private function parseNamedService($name, array $service) |
|
97 |