| Conditions | 2 |
| Paths | 2 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 2.0491 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | public function getClient($clientName) |
||
| 24 | { |
||
| 25 | 1 | $clientServiceName = sprintf( |
|
| 26 | 1 | 'm6web_elasticsearch.client.%s', |
|
| 27 | $clientName |
||
| 28 | 1 | ); |
|
| 29 | |||
| 30 | 1 | $client = $this->getContainer() |
|
| 31 | 1 | ->get( |
|
| 32 | 1 | $clientServiceName, |
|
| 33 | ContainerInterface::NULL_ON_INVALID_REFERENCE |
||
| 34 | 1 | ) |
|
| 35 | 1 | ; |
|
| 36 | |||
| 37 | 1 | if (!$client) { |
|
| 38 | throw new \InvalidArgumentException(sprintf( |
||
| 39 | 'No client "%s" found', |
||
| 40 | $clientName |
||
| 41 | )); |
||
| 42 | } |
||
| 43 | |||
| 44 | 1 | return $client; |
|
| 45 | } |
||
| 46 | } |
||
| 47 |