| Conditions | 6 |
| Paths | 7 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | 4 | public static function createTransport(?RuntimeInterface $runtime = null): TransportInterface |
|
| 26 | { |
||
| 27 | 4 | $runtime ??= new Runtime(); |
|
|
|
|||
| 28 | |||
| 29 | 3 | if ($runtime->classExists(Psr18ClientDiscovery::class) && $runtime->classExists(Psr17FactoryDiscovery::class)) { |
|
| 30 | 2 | try { |
|
| 31 | return new Psr7ClientTransport( |
||
| 32 | Psr18ClientDiscovery::find(), |
||
| 33 | Psr17FactoryDiscovery::findRequestFactory(), |
||
| 34 | Psr17FactoryDiscovery::findStreamFactory() |
||
| 35 | 3 | ); |
|
| 36 | 1 | } catch (NotFoundException $e) { |
|
| 37 | // @ignoreException |
||
| 38 | } |
||
| 39 | 2 | } |
|
| 40 | 1 | ||
| 41 | if ($runtime->classExists(Client::class)) { |
||
| 42 | return new Guzzle6Transport(); |
||
| 43 | 1 | } |
|
| 44 | |||
| 45 | if ($runtime->extensionLoaded('curl')) { |
||
| 52 |