| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public function getAdapter(string $adapterName, array $adapterConfig = []): AdapterInterface |
||
| 12 | { |
||
| 13 | $adapterClass = sprintf('%s\\Adapter\\%sAdapter', __NAMESPACE__, Inflector::classify($adapterName)); |
||
| 14 | |||
| 15 | if (!class_exists($adapterClass)) { |
||
| 16 | throw new \InvalidArgumentException('Adapter class does not exist: ' . $adapterClass); |
||
| 17 | } |
||
| 18 | |||
| 19 | return new $adapterClass($adapterConfig); |
||
| 20 | } |
||
| 21 | } |
||
| 22 |