Conditions | 5 |
Paths | 6 |
Total Lines | 22 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
37 | public static function detectGuzzleVersion() |
||
38 | { |
||
39 | // this namespace only exist since version 5.x+ |
||
40 | if (class_exists('GuzzleHttp\\Client')) { |
||
41 | |||
42 | // default request options are defined differently in version 5 and 6 |
||
43 | $clientReflexion = new \ReflectionClass('GuzzleHttp\\Client'); |
||
44 | if ($clientReflexion->hasProperty('config')) { |
||
45 | return 6; |
||
46 | } |
||
47 | |||
48 | if ($clientReflexion->hasProperty('defaults')) { |
||
49 | return 5; |
||
50 | } |
||
51 | } |
||
52 | |||
53 | if (class_exists('Guzzle\\Service\\Client')) { |
||
54 | return 3; |
||
55 | } |
||
56 | |||
57 | throw new UnsupportedException(); |
||
58 | } |
||
59 | } |
||
60 |