@@ -44,15 +44,15 @@ discard block |
||
44 | 44 | * @param array|Transport\Response $modeldata |
45 | 45 | * @return void |
46 | 46 | */ |
47 | - public function __construct( Pinterest $master, $modeldata = null ) |
|
47 | + public function __construct(Pinterest $master, $modeldata = null) |
|
48 | 48 | { |
49 | 49 | $this->master = $master; |
50 | 50 | |
51 | 51 | // Fill the model |
52 | - if( is_array($modeldata) ){ |
|
52 | + if (is_array($modeldata)) { |
|
53 | 53 | $this->fill($modeldata); |
54 | 54 | } |
55 | - else if( $modeldata instanceof \DirkGroenen\Pinterest\Transport\Response ){ |
|
55 | + else if ($modeldata instanceof \DirkGroenen\Pinterest\Transport\Response) { |
|
56 | 56 | $this->fill($modeldata->data); |
57 | 57 | } |
58 | 58 | } |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function __set($key, $value) |
82 | 82 | { |
83 | - if($this->isFillable($key)){ |
|
83 | + if ($this->isFillable($key)) { |
|
84 | 84 | $this->attributes[$key] = $value; |
85 | 85 | } |
86 | - else{ |
|
87 | - throw new PinterestException( sprintf("%s is not a fillable attribute.", $key) ); |
|
86 | + else { |
|
87 | + throw new PinterestException(sprintf("%s is not a fillable attribute.", $key)); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | */ |
109 | 109 | private function fill(array $attributes) |
110 | 110 | { |
111 | - foreach($attributes as $key => $value){ |
|
112 | - if($this->isFillable($key)){ |
|
111 | + foreach ($attributes as $key => $value) { |
|
112 | + if ($this->isFillable($key)) { |
|
113 | 113 | $this->attributes[$key] = $value; |
114 | 114 | } |
115 | 115 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | { |
138 | 138 | $array = array(); |
139 | 139 | |
140 | - foreach($this->fillable as $key){ |
|
140 | + foreach ($this->fillable as $key) { |
|
141 | 141 | $array[$key] = $this->{$key}; |
142 | 142 | } |
143 | 143 |
@@ -167,29 +167,29 @@ |
||
167 | 167 | CURLOPT_SSL_VERIFYHOST => false, |
168 | 168 | CURLOPT_HEADER => false, |
169 | 169 | CURLINFO_HEADER_OUT => true |
170 | - ) ); |
|
170 | + )); |
|
171 | 171 | |
172 | 172 | switch ($method) { |
173 | 173 | case 'POST': |
174 | - $ch->setOptions( array( |
|
174 | + $ch->setOptions(array( |
|
175 | 175 | CURLOPT_CUSTOMREQUEST => 'POST', |
176 | 176 | CURLOPT_POST => count($parameters), |
177 | 177 | CURLOPT_POSTFIELDS => $parameters |
178 | - ) ); |
|
178 | + )); |
|
179 | 179 | |
180 | - if(!class_exists("\CURLFile") && defined('CURLOPT_SAFE_UPLOAD')) { |
|
181 | - $ch->setOption( CURLOPT_SAFE_UPLOAD, false ); |
|
180 | + if (!class_exists("\CURLFile") && defined('CURLOPT_SAFE_UPLOAD')) { |
|
181 | + $ch->setOption(CURLOPT_SAFE_UPLOAD, false); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | break; |
185 | 185 | case 'DELETE': |
186 | - $ch->setOption( CURLOPT_CUSTOMREQUEST, "DELETE" ); |
|
186 | + $ch->setOption(CURLOPT_CUSTOMREQUEST, "DELETE"); |
|
187 | 187 | break; |
188 | 188 | case 'PATCH': |
189 | - $ch->setOption( CURLOPT_CUSTOMREQUEST, "PATCH" ); |
|
189 | + $ch->setOption(CURLOPT_CUSTOMREQUEST, "PATCH"); |
|
190 | 190 | break; |
191 | 191 | default: |
192 | - $ch->setOption( CURLOPT_CUSTOMREQUEST, "GET" ); |
|
192 | + $ch->setOption(CURLOPT_CUSTOMREQUEST, "GET"); |
|
193 | 193 | break; |
194 | 194 | } |
195 | 195 |
@@ -185,13 +185,13 @@ discard block |
||
185 | 185 | $mr = 5; |
186 | 186 | $body = null; |
187 | 187 | |
188 | - if(ini_get("open_basedir") == "" && ini_get("safe_mode" == "Off")){ |
|
188 | + if (ini_get("open_basedir") == "" && ini_get("safe_mode" == "Off")) { |
|
189 | 189 | curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, $mr > 0); |
190 | 190 | curl_setopt($this->curl, CURLOPT_MAXREDIRS, $mr); |
191 | - } else{ |
|
191 | + } else { |
|
192 | 192 | $this->setOption(CURLOPT_FOLLOWLOCATION, false); |
193 | 193 | |
194 | - if($CURLOPT_MAXREDIRS > 0){ |
|
194 | + if ($CURLOPT_MAXREDIRS > 0) { |
|
195 | 195 | $original_url = $this->getInfo(CURLINFO_EFFECTIVE_URL); |
196 | 196 | $newurl = $original_url; |
197 | 197 | |
@@ -208,24 +208,24 @@ discard block |
||
208 | 208 | $header = substr($response, 0, $header_size); |
209 | 209 | $body = substr($response, $header_size); |
210 | 210 | |
211 | - if(curl_errno($rch)){ |
|
211 | + if (curl_errno($rch)) { |
|
212 | 212 | $code = 0; |
213 | - } else{ |
|
213 | + } else { |
|
214 | 214 | $code = curl_getinfo($rch, CURLINFO_HTTP_CODE); |
215 | 215 | |
216 | 216 | if ($code == 301 || $code == 302) { |
217 | 217 | preg_match('/Location:(.*?)\n/i', $header, $matches); |
218 | 218 | $newurl = trim(array_pop($matches)); |
219 | - } else{ |
|
219 | + } else { |
|
220 | 220 | $code = 0; |
221 | 221 | } |
222 | 222 | } |
223 | - } while($code && --$mr); |
|
223 | + } while ($code && --$mr); |
|
224 | 224 | |
225 | 225 | curl_close($rch); |
226 | 226 | |
227 | - if(!$mr){ |
|
228 | - if ($mr === null){ |
|
227 | + if (!$mr) { |
|
228 | + if ($mr === null) { |
|
229 | 229 | trigger_error('Too many redirects.', E_USER_WARNING); |
230 | 230 | } |
231 | 231 |