1 | <?php namespace Rossedman\Teamwork; |
||
6 | class Client implements RequestableInterface { |
||
7 | |||
8 | /** |
||
9 | * @var GuzzleHttp\Client |
||
10 | */ |
||
11 | protected $client; |
||
12 | |||
13 | /** |
||
14 | * @var GuzzleHttp\Request |
||
15 | */ |
||
16 | protected $request; |
||
17 | |||
18 | /** |
||
19 | * @var GuzzleHttp\Response |
||
20 | */ |
||
21 | protected $response; |
||
22 | |||
23 | /** |
||
24 | * API Key |
||
25 | * |
||
26 | * The custom API key provided by Teamwork |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $key; |
||
31 | |||
32 | /** |
||
33 | * URL |
||
34 | * |
||
35 | * The URL that is set to query the Teamwork API. |
||
36 | * This is the account URL used to access the project |
||
37 | * management system. This is passed in on construct. |
||
38 | * |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $url; |
||
42 | |||
43 | /** |
||
44 | * Currently this package doesn't support XML |
||
45 | * but overtime this would be part of that support |
||
46 | * |
||
47 | * @var string |
||
48 | */ |
||
49 | protected $dataFormat = 'json'; |
||
50 | |||
51 | /** |
||
52 | * @param Guzzle $client |
||
53 | * @param $key |
||
54 | * @param $url |
||
55 | */ |
||
56 | public function __construct(Guzzle $client, $key, $url) |
||
62 | |||
63 | /** |
||
64 | * Get |
||
65 | * |
||
66 | * @param $endpoint |
||
67 | * |
||
68 | * @return Client |
||
69 | */ |
||
70 | public function get($endpoint, $query = null) |
||
76 | |||
77 | /** |
||
78 | * Post |
||
79 | * |
||
80 | * @param $endpoint |
||
81 | * @param $data |
||
82 | * |
||
83 | * @return Client |
||
84 | */ |
||
85 | public function post($endpoint, $data) |
||
89 | |||
90 | /** |
||
91 | * Put |
||
92 | * |
||
93 | * @param $endpoint |
||
94 | * @param $data |
||
95 | * |
||
96 | * @return Client |
||
97 | */ |
||
98 | public function put($endpoint, $data) |
||
102 | |||
103 | /** |
||
104 | * Delete |
||
105 | * |
||
106 | * @param $endpoint |
||
107 | * |
||
108 | * @return Client |
||
109 | * @internal param $data |
||
110 | * |
||
111 | */ |
||
112 | public function delete($endpoint) |
||
116 | |||
117 | /** |
||
118 | * Build Request |
||
119 | * |
||
120 | * build up request including authentication, body, |
||
121 | * and string queries if necessary. This is where the bulk |
||
122 | * of the data is build up to connect to Teamwork with. |
||
123 | * |
||
124 | * @param $endpoint |
||
125 | * @param string $action |
||
126 | * @param array $params |
||
127 | * |
||
128 | * @return $this |
||
129 | */ |
||
130 | public function buildRequest($endpoint, $action, $params = [], $query = null) |
||
148 | |||
149 | /** |
||
150 | * Response |
||
151 | * |
||
152 | * this send the request from the built response and |
||
153 | * returns the response as a JSON payload |
||
154 | */ |
||
155 | public function response() |
||
161 | |||
162 | /** |
||
163 | * Build Url |
||
164 | * |
||
165 | * builds the url to make the request to Teamwork with |
||
166 | * and passes it into Guzzle. Also checks if trailing slash |
||
167 | * is present. |
||
168 | * |
||
169 | * @param $endpoint |
||
170 | * |
||
171 | * @return string |
||
172 | */ |
||
173 | public function buildUrl($endpoint) |
||
187 | |||
188 | /** |
||
189 | * Build Query String |
||
190 | * |
||
191 | * if a query string is needed it will be built up |
||
192 | * and added to the request. This is only used in certain |
||
193 | * GET requests |
||
194 | * |
||
195 | * @param $query |
||
196 | */ |
||
197 | public function buildQuery($query) |
||
206 | |||
207 | /** |
||
208 | * Get Request |
||
209 | * |
||
210 | * @return mixed |
||
211 | */ |
||
212 | public function getRequest() |
||
216 | } |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..