1 | <?php |
||
15 | class ClientAdapter implements ClientInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var \Vinelab\Http\Client |
||
19 | */ |
||
20 | private $client; |
||
21 | |||
22 | /** |
||
23 | * @param null $client |
||
24 | */ |
||
25 | public function setClient($client = null) |
||
29 | |||
30 | /** |
||
31 | * @return HttpClient |
||
32 | */ |
||
33 | public function getClient() |
||
37 | |||
38 | /** |
||
39 | * returns an object of the default HTTP client. |
||
40 | * |
||
41 | * @return \Vinelab\Http\Client |
||
42 | */ |
||
43 | private function defaultClient() |
||
47 | |||
48 | /** |
||
49 | * build the URI from the provided data |
||
50 | * do the actual call to the API through the Http Client |
||
51 | * parse the data to return the shorten URL. |
||
52 | * |
||
53 | * @param $url the url which needs to be Shortened |
||
54 | * @param array $parameters parameters tp be added to the URL |
||
55 | * @param bool $json_formatted the format of the output |
||
56 | * @param string $verb the HTTP verb function in the Client |
||
57 | * |
||
58 | * @return mixed |
||
59 | */ |
||
60 | public function fetchUrl($url, $parameters = [], $json_formatted = true, $verb = 'get') |
||
68 | |||
69 | /** |
||
70 | * build the final URI to be called by the client. |
||
71 | * |
||
72 | * @param $url |
||
73 | * @param $parameters |
||
74 | * |
||
75 | * @return string |
||
76 | */ |
||
77 | private function buildUrl($url, $parameters) |
||
87 | } |
||
88 |