1 | <?php |
||
13 | class MusicInfo |
||
14 | { |
||
15 | use PropertyTrait; |
||
16 | /** |
||
17 | * @var ClientInterface |
||
18 | */ |
||
19 | protected $client; |
||
20 | |||
21 | /** |
||
22 | * @var ArrayCollection |
||
23 | */ |
||
24 | protected $services; |
||
25 | |||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $config; |
||
30 | |||
31 | /** |
||
32 | * Supported Services |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $supportedServices = []; |
||
36 | |||
37 | /** |
||
38 | * MusicInfo constructor. |
||
39 | * @param $config |
||
40 | * @throws ServiceConfigurationException if musicinfo.service is missing |
||
41 | */ |
||
42 | 10 | public function __construct($config) |
|
63 | |||
64 | /** |
||
65 | * @param ClientInterface $client |
||
66 | * |
||
67 | * @return $this |
||
68 | */ |
||
69 | 10 | public function setClient(ClientInterface $client) |
|
75 | |||
76 | /** |
||
77 | * @return ClientInterface |
||
78 | */ |
||
79 | 10 | public function getClient() |
|
83 | |||
84 | /** |
||
85 | * Load service |
||
86 | * |
||
87 | * @param $service |
||
88 | * @param $init |
||
89 | * |
||
90 | * @return IMusicService |
||
91 | * |
||
92 | * @throws \Exception |
||
93 | */ |
||
94 | 10 | public function loadService($service, $init = false) |
|
111 | |||
112 | /** |
||
113 | * Merge shared config with service specific configuration |
||
114 | * |
||
115 | * @param $service |
||
116 | * @return array |
||
117 | */ |
||
118 | 10 | public function mergeConfig($service) |
|
131 | |||
132 | /** |
||
133 | * Load all services |
||
134 | * |
||
135 | * @param bool $initialize |
||
136 | * |
||
137 | * @return ArrayCollection |
||
138 | * @throws \Exception |
||
139 | */ |
||
140 | 1 | public function loadServices($initialize = false) |
|
148 | |||
149 | /** |
||
150 | * @param IMusicService $service |
||
151 | * |
||
152 | * @return $this |
||
153 | */ |
||
154 | 10 | public function addService(IMusicService $service, $key) |
|
159 | |||
160 | /** |
||
161 | * @return ArrayCollection |
||
162 | */ |
||
163 | 1 | public function getServices() |
|
167 | |||
168 | /** |
||
169 | * @param $key |
||
170 | * @return IMusicService|null |
||
171 | */ |
||
172 | 4 | public function getService($key) |
|
181 | |||
182 | /** |
||
183 | * @param BaseService $service |
||
184 | * |
||
185 | * @return BaseService |
||
186 | * @throws ServiceConfigurationException |
||
187 | */ |
||
188 | 3 | public function initializeService(BaseService $service) |
|
196 | |||
197 | /** |
||
198 | * @param string $key |
||
199 | * |
||
200 | * @return $this |
||
201 | */ |
||
202 | 1 | public function removeService($key) |
|
210 | |||
211 | /** |
||
212 | * @return IMusicService |
||
213 | */ |
||
214 | public function getPreferredService() |
||
218 | |||
219 | /** |
||
220 | * Perform Multiservice search |
||
221 | * |
||
222 | * @param $argument |
||
223 | * @param $type |
||
224 | * @param null $servicesArg |
||
225 | * |
||
226 | * @return array |
||
227 | * @throws \Exception |
||
228 | */ |
||
229 | public function doSearch($argument, $type, $servicesArg = null) |
||
260 | } |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.