@@ -51,8 +51,7 @@ discard block |
||
| 51 | 51 | // Fill the model |
| 52 | 52 | if( is_array($modeldata) ){ |
| 53 | 53 | $this->fill($modeldata); |
| 54 | - } |
|
| 55 | - else if( $modeldata instanceof \DirkGroenen\Pinterest\Transport\Response ){ |
|
| 54 | + } else if( $modeldata instanceof \DirkGroenen\Pinterest\Transport\Response ){ |
|
| 56 | 55 | $this->fill($modeldata->data); |
| 57 | 56 | } |
| 58 | 57 | } |
@@ -82,8 +81,7 @@ discard block |
||
| 82 | 81 | { |
| 83 | 82 | if($this->isFillable($key)){ |
| 84 | 83 | $this->attributes[$key] = $value; |
| 85 | - } |
|
| 86 | - else{ |
|
| 84 | + } else{ |
|
| 87 | 85 | throw new PinterestException( sprintf("%s is not a fillable attribute.", $key) ); |
| 88 | 86 | } |
| 89 | 87 | } |
@@ -58,8 +58,7 @@ |
||
| 58 | 58 | if (array_key_exists("image", $data)) { |
| 59 | 59 | if (class_exists("\CURLFile")) { |
| 60 | 60 | $data["image"] = new \CURLFile($data['image']); |
| 61 | - } |
|
| 62 | - else { |
|
| 61 | + } else { |
|
| 63 | 62 | $data["image"] = '@' . $data['image']; |
| 64 | 63 | } |
| 65 | 64 | } |
@@ -67,19 +67,18 @@ 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)) |
|
| 71 | - throw new InvalidModelException; |
|
| 70 | + if (!class_exists("\\DirkGroenen\\Pinterest\\Models\\" . $this->model)) { |
|
| 71 | + throw new InvalidModelException; |
|
| 72 | + } |
|
| 72 | 73 | |
| 73 | 74 | // Get items and response instance |
| 74 | 75 | if (is_array($items)) { |
| 75 | 76 | $this->response = null; |
| 76 | 77 | $this->items = $items; |
| 77 | - } |
|
| 78 | - else if ($items instanceof \DirkGroenen\Pinterest\Transport\Response) { |
|
| 78 | + } else if ($items instanceof \DirkGroenen\Pinterest\Transport\Response) { |
|
| 79 | 79 | $this->response = $items; |
| 80 | 80 | $this->items = $items->data; |
| 81 | - } |
|
| 82 | - else { |
|
| 81 | + } else { |
|
| 83 | 82 | throw new PinterestException("$items needs to be an instance of Transport\Response or an array."); |
| 84 | 83 | } |
| 85 | 84 | |
@@ -89,8 +88,7 @@ discard block |
||
| 89 | 88 | // Add pagination object |
| 90 | 89 | if (isset($this->response->page) && !empty($this->response->page['next'])) { |
| 91 | 90 | $this->pagination = $this->response->page; |
| 92 | - } |
|
| 93 | - else { |
|
| 91 | + } else { |
|
| 94 | 92 | $this->pagination = false; |
| 95 | 93 | } |
| 96 | 94 | } |
@@ -54,8 +54,9 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function __construct($client_id, $client_secret, $curlbuilder = null) |
| 56 | 56 | { |
| 57 | - if ($curlbuilder == null) |
|
| 58 | - $curlbuilder = new CurlBuilder(); |
|
| 57 | + if ($curlbuilder == null) { |
|
| 58 | + $curlbuilder = new CurlBuilder(); |
|
| 59 | + } |
|
| 59 | 60 | |
| 60 | 61 | // Create new instance of Transport\Request |
| 61 | 62 | $this->request = new Request($curlbuilder); |
@@ -80,8 +81,9 @@ discard block |
||
| 80 | 81 | // Check if an instance has already been initiated |
| 81 | 82 | if (!isset($this->cachedEndpoints[$endpoint])) { |
| 82 | 83 | // Check endpoint existence |
| 83 | - if (!class_exists($class)) |
|
| 84 | - throw new InvalidEndpointException; |
|
| 84 | + if (!class_exists($class)) { |
|
| 85 | + throw new InvalidEndpointException; |
|
| 86 | + } |
|
| 85 | 87 | |
| 86 | 88 | // Create a reflection of the called class and initialize it |
| 87 | 89 | // with a reference to the request class |