@@ -11,7 +11,6 @@ |
||
11 | 11 | namespace DirkGroenen\Pinterest\Transport; |
12 | 12 | |
13 | 13 | use DirkGroenen\Pinterest\Utils\CurlBuilder; |
14 | -use DirkGroenen\Pinterest\Exceptions\PinterestException; |
|
15 | 14 | |
16 | 15 | class Response { |
17 | 16 |
@@ -15,11 +15,9 @@ |
||
15 | 15 | $pinterest->auth->setOAuthToken($token->access_token); |
16 | 16 | |
17 | 17 | setcookie("access_token", $token->access_token); |
18 | - } |
|
19 | - else if (isset($_GET["access_token"])) { |
|
18 | + } else if (isset($_GET["access_token"])) { |
|
20 | 19 | $pinterest->auth->setOAuthToken($_GET["access_token"]); |
21 | - } |
|
22 | - else if (isset($_COOKIE["access_token"])) { |
|
20 | + } else if (isset($_COOKIE["access_token"])) { |
|
23 | 21 | $pinterest->auth->setOAuthToken($_COOKIE["access_token"]); |
24 | 22 | } |
25 | 23 |
@@ -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 | } |
@@ -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 |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function delete($endpoint, array $parameters = array()) |
109 | 109 | { |
110 | - return $this->execute("DELETE", sprintf("%s%s", $this->host, $endpoint) . "/", $parameters); |
|
110 | + return $this->execute("DELETE", sprintf("%s%s", $this->host, $endpoint)."/", $parameters); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | // Check if the access token needs to be added |
156 | 156 | if ($this->access_token != null) { |
157 | 157 | $headers = array_merge($headers, array( |
158 | - "Authorization: Bearer " . $this->access_token, |
|
158 | + "Authorization: Bearer ".$this->access_token, |
|
159 | 159 | //"Content-type: application/x-www-form-urlencoded; charset=UTF-8", |
160 | 160 | "Content-Type:multipart/form-data" |
161 | 161 | )); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | |
214 | 214 | // Check if we have a valid response |
215 | 215 | if (!$response_data || $ch->hasErrors()) { |
216 | - throw new PinterestException('Error: execute() - cURL error: ' . $ch->getErrors(), $ch->getErrorNumber()); |
|
216 | + throw new PinterestException('Error: execute() - cURL error: '.$ch->getErrors(), $ch->getErrorNumber()); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | // Initiate the response |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | |
222 | 222 | // Check the response code |
223 | 223 | if ($response->getResponseCode() >= 400) { |
224 | - throw new PinterestException('Pinterest error (code: ' . $response->getResponseCode() . ') with message: ' . $response->getMessage(), $response->getResponseCode()); |
|
224 | + throw new PinterestException('Pinterest error (code: '.$response->getResponseCode().') with message: '.$response->getMessage(), $response->getResponseCode()); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | // Get headers from last request |
@@ -187,8 +187,7 @@ |
||
187 | 187 | |
188 | 188 | if (!class_exists("\CURLFile") && defined('CURLOPT_SAFE_UPLOAD')) { |
189 | 189 | $ch->setOption(CURLOPT_SAFE_UPLOAD, false); |
190 | - } |
|
191 | - elseif (class_exists("\CURLFile") && defined('CURLOPT_SAFE_UPLOAD')) { |
|
190 | + } elseif (class_exists("\CURLFile") && defined('CURLOPT_SAFE_UPLOAD')) { |
|
192 | 191 | $ch->setOption(CURLOPT_SAFE_UPLOAD, true); |
193 | 192 | } |
194 | 193 |
@@ -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)) { |