1 | <?php |
||
29 | class GuzzleClient implements Client |
||
30 | { |
||
31 | /** |
||
32 | * Creates a new instance of GuzzleAdapter |
||
33 | * |
||
34 | * @param Endpoint $endpoint |
||
35 | * @param EventSubscriberInterface[] $plugins |
||
36 | * @return static |
||
37 | */ |
||
38 | public static function create(Endpoint $endpoint, array $plugins = array()) |
||
51 | |||
52 | /** |
||
53 | * @var ClientInterface |
||
54 | */ |
||
55 | private $guzzle; |
||
56 | |||
57 | /** |
||
58 | * @var Endpoint |
||
59 | */ |
||
60 | private $endpoint; |
||
61 | |||
62 | /** |
||
63 | * @param ClientInterface $guzzle |
||
64 | * @param Endpoint $endpoint |
||
65 | */ |
||
66 | public function __construct(ClientInterface $guzzle, Endpoint $endpoint) |
||
71 | |||
72 | /** |
||
73 | * @return Endpoint |
||
74 | */ |
||
75 | public function getEndpoint() |
||
79 | |||
80 | /** |
||
81 | * @return ClientInterface |
||
82 | */ |
||
83 | public function getGuzzle() |
||
87 | |||
88 | /** |
||
89 | * Returns the client base URL |
||
90 | * |
||
91 | * @return string |
||
92 | */ |
||
93 | public function getBaseUrl() |
||
97 | |||
98 | /** |
||
99 | * Sets the user agent |
||
100 | * |
||
101 | * @param string $userAgent |
||
102 | */ |
||
103 | public function setUserAgent($userAgent) |
||
107 | |||
108 | /** |
||
109 | * Performs an HTTP request, returns the body response |
||
110 | * |
||
111 | * @param string $method The method |
||
112 | * @param string $path The path to query |
||
113 | * @param array $query An array of query parameters |
||
114 | * @param array $postFields An array of post fields |
||
115 | * @param array $files An array of post files |
||
116 | * @param array $headers An array of request headers |
||
117 | * |
||
118 | * @return string The response body |
||
119 | * |
||
120 | * @throws BadResponseException |
||
121 | * @throws RuntimeException |
||
122 | */ |
||
123 | public function call( |
||
145 | |||
146 | private function addRequestParameters(RequestInterface $request, $query, $postFields, $files) |
||
170 | } |
||
171 |