@@ -11,7 +11,6 @@ |
||
11 | 11 | namespace DirkGroenen\Pinterest\Auth; |
12 | 12 | |
13 | 13 | use DirkGroenen\Pinterest\Transport\Request; |
14 | -use DirkGroenen\Pinterest\Exceptions\PinterestException; |
|
15 | 14 | |
16 | 15 | class PinterestOAuth { |
17 | 16 |
@@ -50,8 +50,7 @@ |
||
50 | 50 | // Fill the model |
51 | 51 | if (is_array($modeldata)) { |
52 | 52 | $this->fill($modeldata); |
53 | - } |
|
54 | - else if ($modeldata instanceof \DirkGroenen\Pinterest\Transport\Response) { |
|
53 | + } else if ($modeldata instanceof \DirkGroenen\Pinterest\Transport\Response) { |
|
55 | 54 | $this->fill($modeldata->data); |
56 | 55 | } |
57 | 56 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | // Create class path |
68 | 68 | $this->model = ucfirst(strtolower($model)); |
69 | 69 | |
70 | - if (!class_exists("\\DirkGroenen\\Pinterest\\Models\\" . $this->model)) { |
|
70 | + if (!class_exists("\\DirkGroenen\\Pinterest\\Models\\".$this->model)) { |
|
71 | 71 | throw new InvalidModelException; |
72 | 72 | } |
73 | 73 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $modelcollection = []; |
117 | 117 | |
118 | 118 | foreach ($items as $item) { |
119 | - $class = new \ReflectionClass("\\DirkGroenen\\Pinterest\\Models\\" . $this->model); |
|
119 | + $class = new \ReflectionClass("\\DirkGroenen\\Pinterest\\Models\\".$this->model); |
|
120 | 120 | $modelcollection[] = $class->newInstanceArgs([$this->master, $item]); |
121 | 121 | } |
122 | 122 |
@@ -76,7 +76,7 @@ |
||
76 | 76 | public function __get($endpoint) |
77 | 77 | { |
78 | 78 | $endpoint = strtolower($endpoint); |
79 | - $class = "\\DirkGroenen\\Pinterest\\Endpoints\\" . ucfirst($endpoint); |
|
79 | + $class = "\\DirkGroenen\\Pinterest\\Endpoints\\".ucfirst($endpoint); |
|
80 | 80 | |
81 | 81 | // Check if an instance has already been initiated |
82 | 82 | if (!isset($this->cachedEndpoints[$endpoint])) { |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | $prefix = 'DirkGroenen\\Pinterest\\'; |
16 | 16 | |
17 | 17 | // base directory for the namespace prefix |
18 | - $base_dir = __DIR__ . '/src/Pinterest/'; |
|
18 | + $base_dir = __DIR__.'/src/Pinterest/'; |
|
19 | 19 | |
20 | 20 | // does the class use the namespace prefix? |
21 | 21 | $len = strlen($prefix); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | // replace the namespace prefix with the base directory, replace namespace |
31 | 31 | // separators with directory separators in the relative class name, append |
32 | 32 | // with .php |
33 | - $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
33 | + $file = $base_dir.str_replace('\\', '/', $relative_class).'.php'; |
|
34 | 34 | |
35 | 35 | // if the file exists, require it |
36 | 36 | if (file_exists($file)) { |
@@ -188,8 +188,7 @@ discard block |
||
188 | 188 | |
189 | 189 | if (!class_exists('\CURLFile') && defined('CURLOPT_SAFE_UPLOAD')) { |
190 | 190 | $ch->setOption(CURLOPT_SAFE_UPLOAD, false); |
191 | - } |
|
192 | - elseif (class_exists('\CURLFile') && defined('CURLOPT_SAFE_UPLOAD')) { |
|
191 | + } elseif (class_exists('\CURLFile') && defined('CURLOPT_SAFE_UPLOAD')) { |
|
193 | 192 | $ch->setOption(CURLOPT_SAFE_UPLOAD, true); |
194 | 193 | } |
195 | 194 | |
@@ -214,8 +213,7 @@ discard block |
||
214 | 213 | |
215 | 214 | if ($response_data === false && !$ch->hasErrors()) { |
216 | 215 | throw new CurlException("Error: Curl request failed"); |
217 | - } |
|
218 | - else if($ch->hasErrors()) { |
|
216 | + } else if($ch->hasErrors()) { |
|
219 | 217 | throw new PinterestException('Error: execute() - cURL error: ' . $ch->getErrors(), $ch->getErrorNumber()); |
220 | 218 | } |
221 | 219 |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function delete($endpoint, array $parameters = array()) |
123 | 123 | { |
124 | - return $this->execute("DELETE", sprintf("%s%s", $this->host, $endpoint) . "/", $parameters); |
|
124 | + return $this->execute("DELETE", sprintf("%s%s", $this->host, $endpoint)."/", $parameters); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | // Check if the access token needs to be added |
172 | 172 | if ($this->access_token != null) { |
173 | 173 | $headers = array_merge($headers, array( |
174 | - "Authorization: Bearer " . $this->access_token, |
|
174 | + "Authorization: Bearer ".$this->access_token, |
|
175 | 175 | )); |
176 | 176 | } |
177 | 177 | |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | if ($response_data === false && !$ch->hasErrors()) { |
235 | 235 | throw new CurlException("Error: Curl request failed"); |
236 | 236 | } |
237 | - else if($ch->hasErrors()) { |
|
238 | - throw new PinterestException('Error: execute() - cURL error: ' . $ch->getErrors(), $ch->getErrorNumber()); |
|
237 | + else if ($ch->hasErrors()) { |
|
238 | + throw new PinterestException('Error: execute() - cURL error: '.$ch->getErrors(), $ch->getErrorNumber()); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | // Initiate the response |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | // Check the response code |
245 | 245 | if ($response->getResponseCode() >= 400) { |
246 | - throw new PinterestException('Pinterest error (code: ' . $response->getResponseCode() . ') with message: ' . (is_array($response->getMessage()) ? implode(' ', $response->getMessage()) : $response->getMessage()), $response->getResponseCode()); |
|
246 | + throw new PinterestException('Pinterest error (code: '.$response->getResponseCode().') with message: '.(is_array($response->getMessage()) ? implode(' ', $response->getMessage()) : $response->getMessage()), $response->getResponseCode()); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | // Get headers from last request |
@@ -59,7 +59,7 @@ |
||
59 | 59 | if (class_exists('\CURLFile')) { |
60 | 60 | $data["image"] = new \CURLFile($data['image']); |
61 | 61 | } else { |
62 | - $data["image"] = '@' . $data['image']; |
|
62 | + $data["image"] = '@'.$data['image']; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 |
@@ -222,7 +222,7 @@ |
||
222 | 222 | preg_match('/Location:(.*?)\n/i', $header, $matches); |
223 | 223 | $newurl = trim(array_pop($matches)); |
224 | 224 | } else if ($code >= 300 && $code <= 399) { |
225 | - throw new PinterestException('Error: Unhandled 3xx HTTP code: ' . $code); |
|
225 | + throw new PinterestException('Error: Unhandled 3xx HTTP code: '.$code); |
|
226 | 226 | } else { |
227 | 227 | $code = 0; |
228 | 228 | } |