| @@ 11-26 (lines=16) @@ | ||
| 8 | /** |
|
| 9 | * @author Tobias Nyholm <[email protected]> |
|
| 10 | */ |
|
| 11 | class Guzzle5Factory implements ClientFactoryInterface |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * {@inheritdoc} |
|
| 15 | */ |
|
| 16 | public function createClient(array $config = []) |
|
| 17 | { |
|
| 18 | if (!class_exists('Http\Adapter\Guzzle5\Client')) { |
|
| 19 | throw new \LogicException('To use the Guzzle5 adapter you need to install the "php-http/guzzle5-adapter" package.'); |
|
| 20 | } |
|
| 21 | ||
| 22 | $client = new Client($config); |
|
| 23 | ||
| 24 | return new Adapter($client); |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||
| @@ 11-26 (lines=16) @@ | ||
| 8 | /** |
|
| 9 | * @author Tobias Nyholm <[email protected]> |
|
| 10 | */ |
|
| 11 | class Guzzle6Factory implements ClientFactoryInterface |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * {@inheritdoc} |
|
| 15 | */ |
|
| 16 | public function createClient(array $config = []) |
|
| 17 | { |
|
| 18 | if (!class_exists('Http\Adapter\Guzzle6\Client')) { |
|
| 19 | throw new \LogicException('To use the Guzzle6 adapter you need to install the "php-http/guzzle6-adapter" package.'); |
|
| 20 | } |
|
| 21 | ||
| 22 | $client = new Client($config); |
|
| 23 | ||
| 24 | return new Adapter($client); |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||