Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | public function getService(string $serviceName): Service |
||
30 | { |
||
31 | $serviceClass = __NAMESPACE__ . '\\Services\\' . ucfirst($serviceName); |
||
32 | |||
33 | if (!class_exists($serviceClass)) { |
||
34 | throw new \Promopult\Dadata\Exceptions\ServiceNotFoundException( |
||
35 | "Service with {$serviceName} is not found." |
||
36 | ); |
||
37 | } |
||
38 | |||
39 | return new $serviceClass( |
||
40 | $this->credentials, |
||
41 | $this->httpClient |
||
42 | ); |
||
50 |