| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 47 | 3 | public function __invoke(string $command): ClientHandler |
|
| 48 | { |
||
| 49 | 3 | $handlerClass = null; |
|
| 50 | 3 | if (strpos($command, 'DMT\\WebservicesNl\\') === 0) { |
|
| 51 | 2 | $handlerClass = preg_replace( |
|
| 52 | 2 | '~^(DMT\\\WebservicesNl\\\)([^\\\]+)(\\\.*)?(\\\.*)$~', |
|
| 53 | 2 | "$1$2\\\\$2Handler", |
|
| 54 | 2 | $command |
|
| 55 | ); |
||
| 56 | } |
||
| 57 | |||
| 58 | 3 | if (!$handlerClass || !class_exists($handlerClass)) { |
|
| 59 | 2 | throw new UnknownRequestException('Could not process ' . $command); |
|
| 60 | } |
||
| 61 | |||
| 62 | 1 | return new $handlerClass($this->httpClient, $this->serializer, ...explode('-', $this->format)); |
|
| 63 | } |
||
| 65 |