Total Complexity | 4 |
Total Lines | 25 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
12 | class DynamicSaasClientAccessorService |
||
13 | { |
||
14 | /** @var SaasClientService */ |
||
15 | private $_clientService; |
||
16 | |||
17 | public function __call($name, $arguments) |
||
18 | { |
||
19 | $client = $this->_clientService->getCurrentClient(); |
||
20 | |||
21 | $method = "get$name"; |
||
22 | if (method_exists($client, $method)) { |
||
23 | return $client->$method(); |
||
24 | } |
||
25 | $method = "is$name"; |
||
26 | if (method_exists($client, $method)) { |
||
27 | return $client->$method(); |
||
28 | } |
||
29 | |||
30 | throw new \Exception("Unknown Settings function / variable: {$name}!"); |
||
31 | } |
||
32 | |||
33 | /** @required */ |
||
34 | public function setClientService(SaasClientService $clientService) |
||
37 | } |
||
38 | } |
||
39 |