| Conditions | 4 |
| Paths | 4 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php |
||
| 43 | public function resolve() |
||
| 44 | { |
||
| 45 | $result = null; |
||
| 46 | $exceptions = []; |
||
| 47 | |||
| 48 | foreach ($this->adapters as $adapter) { |
||
| 49 | try { |
||
| 50 | $result = new $adapter(); |
||
| 51 | break; |
||
| 52 | } catch (AdapterNotAvailableException $exception) { |
||
| 53 | $exceptions[] = $exception->getMessage(); |
||
| 54 | } |
||
| 55 | } |
||
| 56 | |||
| 57 | if (count($exceptions) === count($this->adapters)) { |
||
| 58 | throw new AdapterNotFoundException($exceptions); |
||
| 59 | } |
||
| 60 | |||
| 61 | return $result; |
||
| 62 | } |
||
| 63 | |||
| 65 |