| Conditions | 3 |
| Paths | 6 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3.0261 |
| Changes | 4 | ||
| Bugs | 0 | Features | 2 |
| 1 | <?php |
||
| 23 | 1 | public static function find() |
|
| 24 | { |
||
| 25 | try { |
||
| 26 | $asyncClient = static::findOneByType(HttpAsyncClient::class); |
||
| 27 | |||
| 28 | // Something like this |
||
| 29 | if (is_string($asyncClient)) { |
||
| 30 | return new $asyncClient(); |
||
| 31 | } |
||
| 32 | |||
| 33 | return $asyncClient(); |
||
| 34 | 1 | } catch (DiscoveryFailedException $e) { |
|
| 35 | 1 | throw new NotFoundException( |
|
| 36 | 1 | 'No HTTPlug async clients found. Make sure to install a package providing "php-http/async-client-implementation". Example: "php-http/guzzle6-adapter".', |
|
| 37 | 1 | 0, |
|
| 38 | $e |
||
| 39 | 1 | ); |
|
| 40 | } |
||
| 41 | } |
||
| 42 | } |
||
| 43 |