@@ -95,7 +95,7 @@ |
||
| 95 | 95 | * @param $service |
| 96 | 96 | * @param $init |
| 97 | 97 | * |
| 98 | - * @return bool |
|
| 98 | + * @return boolean|null |
|
| 99 | 99 | * |
| 100 | 100 | * @throws \Exception |
| 101 | 101 | */ |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | new Client($config['defaults']['guzzle']) |
| 46 | 46 | ); |
| 47 | 47 | |
| 48 | - if(isset($config['services'])) { |
|
| 49 | - foreach($config['services'] as $service) { |
|
| 50 | - if(!isset($config['init'])) { |
|
| 48 | + if (isset($config['services'])) { |
|
| 49 | + foreach ($config['services'] as $service) { |
|
| 50 | + if (!isset($config['init'])) { |
|
| 51 | 51 | $config['init'] = null; |
| 52 | 52 | } |
| 53 | 53 | $this->loadService($service, $config['init']); |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function loadService($service, $init = false) |
| 103 | 103 | { |
| 104 | - $fqcn = implode('\\',['Pbxg33k', 'MusicInfo', 'Service', $service, 'Service']); |
|
| 105 | - if(class_exists($fqcn)) { |
|
| 104 | + $fqcn = implode('\\', ['Pbxg33k', 'MusicInfo', 'Service', $service, 'Service']); |
|
| 105 | + if (class_exists($fqcn)) { |
|
| 106 | 106 | /** @var IMusicService $client */ |
| 107 | 107 | $client = new $fqcn(); |
| 108 | 108 | $client->setConfig($this->mergeConfig($service)); |
| 109 | 109 | $client->setClient($this->getClient()); |
| 110 | - if($init == true) { |
|
| 110 | + if ($init == true) { |
|
| 111 | 111 | $client->init(); |
| 112 | 112 | } |
| 113 | 113 | $this->addService($client, $service); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | public function mergeConfig($service) |
| 126 | 126 | { |
| 127 | 127 | $service = strtolower($service); |
| 128 | - if(isset($this->config[$service])) { |
|
| 128 | + if (isset($this->config[$service])) { |
|
| 129 | 129 | $config = array_merge( |
| 130 | 130 | $this->config[$service], |
| 131 | 131 | $this->config['defaults'] |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function loadServices() |
| 145 | 145 | { |
| 146 | - foreach($this->supportedServices as $service) { |
|
| 146 | + foreach ($this->supportedServices as $service) { |
|
| 147 | 147 | $this->loadService($service); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | public function getService($key) |
| 177 | 177 | { |
| 178 | 178 | $key = strtolower($key); |
| 179 | - if(isset($this->services[$key])) { |
|
| 179 | + if (isset($this->services[$key])) { |
|
| 180 | 180 | return $this->services[$key]; |
| 181 | 181 | } else { |
| 182 | 182 | return null; |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | public function removeService($key) |
| 192 | 192 | { |
| 193 | - if(isset($this->services[$key])) { |
|
| 193 | + if (isset($this->services[$key])) { |
|
| 194 | 194 | unset($this->services[$key]); |
| 195 | 195 | } |
| 196 | 196 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | * @param $config |
| 34 | 34 | * @return mixed |
| 35 | 35 | */ |
| 36 | - public function setConfig($config= null); |
|
| 36 | + public function setConfig($config = null); |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * @return mixed |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function init($config = null) |
| 17 | 17 | { |
| 18 | - if(!$config) { |
|
| 18 | + if (!$config) { |
|
| 19 | 19 | $config = $this->getConfig()['guzzle']; |
| 20 | 20 | } |
| 21 | 21 | |