| @@ 17-31 (lines=15) @@ | ||
| 14 | * |
|
| 15 | * @throws NotSupportedException when Guzzle vendor version is not supported. |
|
| 16 | */ |
|
| 17 | public static function createGuzzle($baseUri, $options) |
|
| 18 | { |
|
| 19 | $guzzleVersion = self::detectGuzzleVersion(); |
|
| 20 | ||
| 21 | switch ($guzzleVersion) { |
|
| 22 | case 6: |
|
| 23 | return new Version\Guzzle6($baseUri, $options); |
|
| 24 | ||
| 25 | case 5: |
|
| 26 | return new Version\Guzzle5($baseUri); |
|
| 27 | ||
| 28 | case 3: |
|
| 29 | return new Version\Guzzle3($baseUri); |
|
| 30 | } |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @return int current Guzzle vendor version. |
|
| @@ 79-93 (lines=15) @@ | ||
| 76 | return class_exists('Guzzle\\Service\\Client'); |
|
| 77 | } |
|
| 78 | ||
| 79 | public static function createMockedClient(array $mockedResponseCollection) |
|
| 80 | { |
|
| 81 | $guzzleVersion = self::detectGuzzleVersion(); |
|
| 82 | ||
| 83 | switch ($guzzleVersion) { |
|
| 84 | case 6: |
|
| 85 | return new Version\Guzzle6($baseUri); |
|
| 86 | ||
| 87 | case 5: |
|
| 88 | return new Guzzle5Mock($mockedResponseCollection); |
|
| 89 | ||
| 90 | case 3: |
|
| 91 | return new Version\Guzzle3($baseUri); |
|
| 92 | } |
|
| 93 | } |
|
| 94 | } |
|
| 95 | ||