Conditions | 3 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
23 | 2 | public static function create(LoopInterface $loop = null, array $options = []): Client |
|
24 | { |
||
25 | 2 | if (!($loop instanceof LoopInterface)) { |
|
26 | 1 | $loop = LoopFactory::create(); |
|
27 | } |
||
28 | |||
29 | 2 | if (!isset($options['dns'])) { |
|
30 | 2 | $options['dns'] = '8.8.8.8'; |
|
31 | } |
||
32 | |||
33 | 2 | $resolver = (new ResolverFactory())->createCached($options['dns'], $loop); |
|
34 | 2 | $httpClient = (new HttpClientFactory())->create($loop, $resolver); |
|
35 | |||
36 | 2 | return self::createFromReactHttpClient( |
|
37 | $httpClient, |
||
38 | $resolver, |
||
39 | $loop, |
||
40 | $options |
||
41 | ); |
||
42 | } |
||
43 | |||
74 |
It seems like you allow that null is being passed for a parameter, however the function which is called does not seem to accept null.
We recommend to add an additional type check (or disallow null for the parameter):