@@ -89,8 +89,8 @@ |
||
| 89 | 89 | * Make a post request to the given endpoint |
| 90 | 90 | * |
| 91 | 91 | * @access public |
| 92 | - * @param string $path |
|
| 93 | 92 | * @param array $parameters |
| 93 | + * @param string $endpoint |
|
| 94 | 94 | * @return Response |
| 95 | 95 | */ |
| 96 | 96 | public function post( $endpoint, array $parameters = array() ) |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @param CurlBuilder $curlbuilder |
| 50 | 50 | */ |
| 51 | - public function __construct( CurlBuilder $curlbuilder ) |
|
| 51 | + public function __construct(CurlBuilder $curlbuilder) |
|
| 52 | 52 | { |
| 53 | 53 | $this->curlbuilder = $curlbuilder; |
| 54 | 54 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @param string $token |
| 61 | 61 | * @return void |
| 62 | 62 | */ |
| 63 | - public function setAccessToken( $token ) |
|
| 63 | + public function setAccessToken($token) |
|
| 64 | 64 | { |
| 65 | 65 | $this->access_token = $token; |
| 66 | 66 | } |
@@ -73,9 +73,9 @@ discard block |
||
| 73 | 73 | * @param array $parameters |
| 74 | 74 | * @return Response |
| 75 | 75 | */ |
| 76 | - public function get( $endpoint, array $parameters = array() ) |
|
| 76 | + public function get($endpoint, array $parameters = array()) |
|
| 77 | 77 | { |
| 78 | - if(!empty($parameters)) { |
|
| 78 | + if (!empty($parameters)) { |
|
| 79 | 79 | $path = sprintf("%s/?%s", $endpoint, http_build_query($parameters)); |
| 80 | 80 | } |
| 81 | 81 | else { |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | * @param array $parameters |
| 94 | 94 | * @return Response |
| 95 | 95 | */ |
| 96 | - public function post( $endpoint, array $parameters = array() ) |
|
| 96 | + public function post($endpoint, array $parameters = array()) |
|
| 97 | 97 | { |
| 98 | - return $this->execute("POST", sprintf("%s%s", $this->host, $endpoint), $parameters ); |
|
| 98 | + return $this->execute("POST", sprintf("%s%s", $this->host, $endpoint), $parameters); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -106,9 +106,9 @@ discard block |
||
| 106 | 106 | * @param array $parameters |
| 107 | 107 | * @return Response |
| 108 | 108 | */ |
| 109 | - public function delete( $endpoint, array $parameters = array() ) |
|
| 109 | + public function delete($endpoint, array $parameters = array()) |
|
| 110 | 110 | { |
| 111 | - return $this->execute("DELETE", sprintf("%s%s", $this->host, $endpoint) . "/", $parameters ); |
|
| 111 | + return $this->execute("DELETE", sprintf("%s%s", $this->host, $endpoint) . "/", $parameters); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -119,9 +119,9 @@ discard block |
||
| 119 | 119 | * @param array $parameters |
| 120 | 120 | * @return Response |
| 121 | 121 | */ |
| 122 | - public function update( $endpoint, array $parameters = array() ) |
|
| 122 | + public function update($endpoint, array $parameters = array()) |
|
| 123 | 123 | { |
| 124 | - return $this->execute("PATCH", sprintf("%s%s", $this->host, $endpoint) . "/", $parameters ); |
|
| 124 | + return $this->execute("PATCH", sprintf("%s%s", $this->host, $endpoint) . "/", $parameters); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | * @param array $headers |
| 145 | 145 | * @return Response |
| 146 | 146 | */ |
| 147 | - public function execute( $method, $apiCall, array $parameters = array(), $headers = array() ) |
|
| 147 | + public function execute($method, $apiCall, array $parameters = array(), $headers = array()) |
|
| 148 | 148 | { |
| 149 | 149 | // Check if the access token needs to be added |
| 150 | - if($this->access_token != null){ |
|
| 150 | + if ($this->access_token != null) { |
|
| 151 | 151 | $headers = array_merge($headers, array( |
| 152 | 152 | "Authorization: Bearer " . $this->access_token, |
| 153 | 153 | "Content-ype: multipart/form-data", |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $ch = $this->curlbuilder->create(); |
| 159 | 159 | |
| 160 | 160 | // Set default options |
| 161 | - $ch->setOptions( array( |
|
| 161 | + $ch->setOptions(array( |
|
| 162 | 162 | CURLOPT_URL => $apiCall, |
| 163 | 163 | CURLOPT_HTTPHEADER => $headers, |
| 164 | 164 | CURLOPT_CONNECTTIMEOUT => 20, |
@@ -168,28 +168,28 @@ discard block |
||
| 168 | 168 | CURLOPT_SSL_VERIFYHOST => false, |
| 169 | 169 | CURLOPT_HEADER => false, |
| 170 | 170 | CURLINFO_HEADER_OUT => true |
| 171 | - ) ); |
|
| 171 | + )); |
|
| 172 | 172 | |
| 173 | 173 | switch ($method) { |
| 174 | 174 | case 'POST': |
| 175 | - $ch->setOptions( array( |
|
| 175 | + $ch->setOptions(array( |
|
| 176 | 176 | CURLOPT_CUSTOMREQUEST => 'POST', |
| 177 | 177 | CURLOPT_POST => count($parameters), |
| 178 | 178 | CURLOPT_POSTFIELDS => $parameters |
| 179 | - ) ); |
|
| 179 | + )); |
|
| 180 | 180 | |
| 181 | - if(!class_exists("\CURLFile") && defined('CURLOPT_SAFE_UPLOAD')) |
|
| 182 | - $ch->setOption( CURLOPT_SAFE_UPLOAD, false ); |
|
| 181 | + if (!class_exists("\CURLFile") && defined('CURLOPT_SAFE_UPLOAD')) |
|
| 182 | + $ch->setOption(CURLOPT_SAFE_UPLOAD, false); |
|
| 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 | |
@@ -198,16 +198,16 @@ discard block |
||
| 198 | 198 | $response_data = $ch->execute(); |
| 199 | 199 | |
| 200 | 200 | // Check if we have a valid response |
| 201 | - if ( !$response_data || $ch->hasErrors() ) { |
|
| 202 | - throw new PinterestException( 'Error: execute() - cURL error: ' . $ch->getErrors(), $ch->getErrorNumber() ); |
|
| 201 | + if (!$response_data || $ch->hasErrors()) { |
|
| 202 | + throw new PinterestException('Error: execute() - cURL error: ' . $ch->getErrors(), $ch->getErrorNumber()); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | // Initiate the response |
| 206 | 206 | $response = new Response($response_data, $ch); |
| 207 | 207 | |
| 208 | 208 | // Check the response code |
| 209 | - if ( $response->getResponseCode() >= 400 ) { |
|
| 210 | - throw new PinterestException( 'Pinterest error (code: ' . $response->getResponseCode() . ') with message: ' . $response->message, $response->getResponseCode() ); |
|
| 209 | + if ($response->getResponseCode() >= 400) { |
|
| 210 | + throw new PinterestException('Pinterest error (code: ' . $response->getResponseCode() . ') with message: ' . $response->message, $response->getResponseCode()); |
|
| 211 | 211 | } |
| 212 | 212 | $this->headers = $ch->getHeaders(); |
| 213 | 213 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @access public |
| 54 | 54 | * @param string $option |
| 55 | - * @param mixed $value |
|
| 55 | + * @param false|string $value |
|
| 56 | 56 | * @return $this |
| 57 | 57 | */ |
| 58 | 58 | public function setOption( $option, $value ) |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * Execute the curl request |
| 81 | 81 | * |
| 82 | 82 | * @access public |
| 83 | - * @return mixed |
|
| 83 | + * @return false|string |
|
| 84 | 84 | */ |
| 85 | 85 | public function execute() |
| 86 | 86 | { |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * Check if the curl request ended up with errors |
| 92 | 92 | * |
| 93 | 93 | * @access public |
| 94 | - * @return boolean |
|
| 94 | + * @return integer |
|
| 95 | 95 | */ |
| 96 | 96 | public function hasErrors() |
| 97 | 97 | { |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * Parse string headers into array |
| 159 | 159 | * |
| 160 | 160 | * @access private |
| 161 | - * @param array $headers |
|
| 161 | + * @param string $headers |
|
| 162 | 162 | * @return array |
| 163 | 163 | */ |
| 164 | 164 | private function parseHeaders($headers) { |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * @see http://slopjong.de/2012/03/31/curl-follow-locations-with-safe_mode-enabled-or-open_basedir-set/ |
| 182 | 182 | * @access private |
| 183 | - * @return mixed |
|
| 183 | + * @return false|string |
|
| 184 | 184 | */ |
| 185 | 185 | private function execFollow() { |
| 186 | 186 | $mr = 5; |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | * @param mixed $value |
| 56 | 56 | * @return $this |
| 57 | 57 | */ |
| 58 | - public function setOption( $option, $value ) |
|
| 58 | + public function setOption($option, $value) |
|
| 59 | 59 | { |
| 60 | - curl_setopt($this->curl, $option, $value ); |
|
| 60 | + curl_setopt($this->curl, $option, $value); |
|
| 61 | 61 | |
| 62 | 62 | return $this; |
| 63 | 63 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param array $options |
| 70 | 70 | * @return $this |
| 71 | 71 | */ |
| 72 | - public function setOptions( array $options = [] ) |
|
| 72 | + public function setOptions(array $options = []) |
|
| 73 | 73 | { |
| 74 | 74 | curl_setopt_array($this->curl, $options); |
| 75 | 75 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | private function parseHeaders($headers) { |
| 165 | 165 | $result = array(); |
| 166 | - foreach(explode("\n", $headers) as $row){ |
|
| 166 | + foreach (explode("\n", $headers) as $row) { |
|
| 167 | 167 | $header = explode(':', $row, 2); |
| 168 | 168 | if (count($header) == 2) |
| 169 | 169 | $result[$header[0]] = trim($header[1]); |
@@ -186,14 +186,14 @@ discard block |
||
| 186 | 186 | $mr = 5; |
| 187 | 187 | $body = null; |
| 188 | 188 | |
| 189 | - if(ini_get("open_basedir") == "" && ini_get("safe_mode" == "Off")){ |
|
| 189 | + if (ini_get("open_basedir") == "" && ini_get("safe_mode" == "Off")) { |
|
| 190 | 190 | curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, $mr > 0); |
| 191 | 191 | curl_setopt($this->curl, CURLOPT_MAXREDIRS, $mr); |
| 192 | 192 | } |
| 193 | - else{ |
|
| 193 | + else { |
|
| 194 | 194 | $this->setOption(CURLOPT_FOLLOWLOCATION, false); |
| 195 | 195 | |
| 196 | - if($mr > 0){ |
|
| 196 | + if ($mr > 0) { |
|
| 197 | 197 | $original_url = $this->getInfo(CURLINFO_EFFECTIVE_URL); |
| 198 | 198 | $newurl = $original_url; |
| 199 | 199 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | curl_setopt($rch, CURLOPT_HEADER, true); |
| 203 | 203 | curl_setopt($rch, CURLOPT_FORBID_REUSE, false); |
| 204 | 204 | |
| 205 | - do{ |
|
| 205 | + do { |
|
| 206 | 206 | curl_setopt($rch, CURLOPT_URL, $newurl); |
| 207 | 207 | $response = curl_exec($rch); |
| 208 | 208 | |
@@ -210,29 +210,29 @@ discard block |
||
| 210 | 210 | $header = substr($response, 0, $header_size); |
| 211 | 211 | $body = substr($response, $header_size); |
| 212 | 212 | |
| 213 | - if(curl_errno($rch)){ |
|
| 213 | + if (curl_errno($rch)) { |
|
| 214 | 214 | $code = 0; |
| 215 | 215 | } |
| 216 | - else{ |
|
| 216 | + else { |
|
| 217 | 217 | $code = curl_getinfo($rch, CURLINFO_HTTP_CODE); |
| 218 | 218 | |
| 219 | 219 | if ($code == 301 || $code == 302) { |
| 220 | 220 | preg_match('/Location:(.*?)\n/i', $header, $matches); |
| 221 | 221 | $newurl = trim(array_pop($matches)); |
| 222 | 222 | } |
| 223 | - else{ |
|
| 223 | + else { |
|
| 224 | 224 | $code = 0; |
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | - } while($code && --$mr); |
|
| 227 | + } while ($code && --$mr); |
|
| 228 | 228 | |
| 229 | 229 | curl_close($rch); |
| 230 | 230 | |
| 231 | - if(!$mr){ |
|
| 232 | - if ($mr === null){ |
|
| 231 | + if (!$mr) { |
|
| 232 | + if ($mr === null) { |
|
| 233 | 233 | trigger_error('Too many redirects.', E_USER_WARNING); |
| 234 | 234 | } |
| 235 | - else{ |
|
| 235 | + else { |
|
| 236 | 236 | $mr = 0; |
| 237 | 237 | } |
| 238 | 238 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - if (!$body){ |
|
| 247 | + if (!$body) { |
|
| 248 | 248 | curl_setopt($this->curl, CURLOPT_HEADER, true); |
| 249 | 249 | $response = curl_exec($this->curl); |
| 250 | 250 | |
@@ -13,11 +13,11 @@ |
||
| 13 | 13 | use DirkGroenen\Pinterest\Utils\CurlBuilder; |
| 14 | 14 | use DirkGroenen\Pinterest\Exceptions\PinterestException; |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * @property array $page |
|
| 18 | - * @property array $data |
|
| 19 | - * @property string $message |
|
| 20 | - */ |
|
| 16 | + /** |
|
| 17 | + * @property array $page |
|
| 18 | + * @property array $data |
|
| 19 | + * @property string $message |
|
| 20 | + */ |
|
| 21 | 21 | class Response { |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | * @throws Exceptions/PinterestExceptions |
| 25 | 25 | * @return Models\Board |
| 26 | 26 | */ |
| 27 | - public function get( $board_id, array $data = [] ) |
|
| 27 | + public function get($board_id, array $data = []) |
|
| 28 | 28 | { |
| 29 | - $response = $this->request->get( sprintf("boards/%s", $board_id), $data ); |
|
| 30 | - return new Board( $this->master, $response ); |
|
| 29 | + $response = $this->request->get(sprintf("boards/%s", $board_id), $data); |
|
| 30 | + return new Board($this->master, $response); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | * @throws Exceptions/PinterestExceptions |
| 39 | 39 | * @return Models\Board |
| 40 | 40 | */ |
| 41 | - public function create( array $data ) |
|
| 41 | + public function create(array $data) |
|
| 42 | 42 | { |
| 43 | - $response = $this->request->post( "boards", $data ); |
|
| 44 | - return new Board( $this->master, $response ); |
|
| 43 | + $response = $this->request->post("boards", $data); |
|
| 44 | + return new Board($this->master, $response); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | * @throws Exceptions/PinterestExceptions |
| 53 | 53 | * @return Models\Board |
| 54 | 54 | */ |
| 55 | - public function delete( $board_id ) |
|
| 55 | + public function delete($board_id) |
|
| 56 | 56 | { |
| 57 | - $this->request->delete( sprintf("boards/%s", $board_id) ); |
|
| 57 | + $this->request->delete(sprintf("boards/%s", $board_id)); |
|
| 58 | 58 | return true; |
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | \ No newline at end of file |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | * @throws Exceptions/PinterestExceptions |
| 25 | 25 | * @return Collection |
| 26 | 26 | */ |
| 27 | - public function users( array $data = [] ) |
|
| 27 | + public function users(array $data = []) |
|
| 28 | 28 | { |
| 29 | - $response = $this->request->get( "me/following/users", $data ); |
|
| 30 | - return new Collection( $this->master, $response, "User" ); |
|
| 29 | + $response = $this->request->get("me/following/users", $data); |
|
| 30 | + return new Collection($this->master, $response, "User"); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | * @throws Exceptions/PinterestExceptions |
| 39 | 39 | * @return Collection |
| 40 | 40 | */ |
| 41 | - public function boards( array $data = [] ) |
|
| 41 | + public function boards(array $data = []) |
|
| 42 | 42 | { |
| 43 | - $response = $this->request->get( "me/following/boards", $data ); |
|
| 44 | - return new Collection( $this->master, $response, "Board" ); |
|
| 43 | + $response = $this->request->get("me/following/boards", $data); |
|
| 44 | + return new Collection($this->master, $response, "Board"); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | * @throws Exceptions/PinterestExceptions |
| 53 | 53 | * @return Collection |
| 54 | 54 | */ |
| 55 | - public function interests( array $data = [] ) |
|
| 55 | + public function interests(array $data = []) |
|
| 56 | 56 | { |
| 57 | - $response = $this->request->get( "me/following/interests", $data ); |
|
| 58 | - return new Collection( $this->master, $response, "Interest" ); |
|
| 57 | + $response = $this->request->get("me/following/interests", $data); |
|
| 58 | + return new Collection($this->master, $response, "Interest"); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | * @throws Exceptions/PinterestExceptions |
| 67 | 67 | * @return boolean |
| 68 | 68 | */ |
| 69 | - public function followUser( $user ) |
|
| 69 | + public function followUser($user) |
|
| 70 | 70 | { |
| 71 | - $this->request->post( "me/following/users", array( |
|
| 71 | + $this->request->post("me/following/users", array( |
|
| 72 | 72 | "user" => $user |
| 73 | - ) ); |
|
| 73 | + )); |
|
| 74 | 74 | return true; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | * @throws Exceptions/PinterestExceptions |
| 83 | 83 | * @return boolean |
| 84 | 84 | */ |
| 85 | - public function unfollowUser( $user ) |
|
| 85 | + public function unfollowUser($user) |
|
| 86 | 86 | { |
| 87 | - $this->request->delete( sprintf("me/following/users/%s", $user) ); |
|
| 87 | + $this->request->delete(sprintf("me/following/users/%s", $user)); |
|
| 88 | 88 | return true; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -96,11 +96,11 @@ discard block |
||
| 96 | 96 | * @throws Exceptions/PinterestExceptions |
| 97 | 97 | * @return boolean |
| 98 | 98 | */ |
| 99 | - public function followBoard( $board ) |
|
| 99 | + public function followBoard($board) |
|
| 100 | 100 | { |
| 101 | - $this->request->post( "me/following/boards", array( |
|
| 101 | + $this->request->post("me/following/boards", array( |
|
| 102 | 102 | "board" => $board |
| 103 | - ) ); |
|
| 103 | + )); |
|
| 104 | 104 | return true; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | * @throws Exceptions/PinterestExceptions |
| 113 | 113 | * @return boolean |
| 114 | 114 | */ |
| 115 | - public function unfollowBoard( $board_id ) |
|
| 115 | + public function unfollowBoard($board_id) |
|
| 116 | 116 | { |
| 117 | - $this->request->delete( sprintf("me/following/boards/%s", $board_id) ); |
|
| 117 | + $this->request->delete(sprintf("me/following/boards/%s", $board_id)); |
|
| 118 | 118 | return true; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -126,11 +126,11 @@ discard block |
||
| 126 | 126 | * @throws Exceptions/PinterestExceptions |
| 127 | 127 | * @return boolean |
| 128 | 128 | */ |
| 129 | - public function followInterest( $interest ) |
|
| 129 | + public function followInterest($interest) |
|
| 130 | 130 | { |
| 131 | - $this->request->post( "me/following/interests", array( |
|
| 131 | + $this->request->post("me/following/interests", array( |
|
| 132 | 132 | "interest" => $interest |
| 133 | - ) ); |
|
| 133 | + )); |
|
| 134 | 134 | return true; |
| 135 | 135 | } |
| 136 | 136 | |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | * @throws Exceptions/PinterestExceptions |
| 143 | 143 | * @return boolean |
| 144 | 144 | */ |
| 145 | - public function unfollowInterest( $interest_id ) |
|
| 145 | + public function unfollowInterest($interest_id) |
|
| 146 | 146 | { |
| 147 | - $this->request->delete( sprintf("me/following/interests/%s", $interest_id) ); |
|
| 147 | + $this->request->delete(sprintf("me/following/interests/%s", $interest_id)); |
|
| 148 | 148 | return true; |
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | \ No newline at end of file |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | * @throws Exceptions/PinterestExceptions |
| 25 | 25 | * @return Models\Pin |
| 26 | 26 | */ |
| 27 | - public function get( $pin_id, array $data = [] ) |
|
| 27 | + public function get($pin_id, array $data = []) |
|
| 28 | 28 | { |
| 29 | - $response = $this->request->get( sprintf("pins/%s", $pin_id), $data ); |
|
| 30 | - return new Pin( $this->master, $response ); |
|
| 29 | + $response = $this->request->get(sprintf("pins/%s", $pin_id), $data); |
|
| 30 | + return new Pin($this->master, $response); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | * @throws Exceptions/PinterestExceptions |
| 40 | 40 | * @return Models\Collection |
| 41 | 41 | */ |
| 42 | - public function fromBoard( $board_id, array $data = [] ) |
|
| 42 | + public function fromBoard($board_id, array $data = []) |
|
| 43 | 43 | { |
| 44 | - $response = $this->request->get( sprintf("boards/%s/pins", $board_id), $data ); |
|
| 45 | - return new Collection( $this->master, $response, "Pin" ); |
|
| 44 | + $response = $this->request->get(sprintf("boards/%s/pins", $board_id), $data); |
|
| 45 | + return new Collection($this->master, $response, "Pin"); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -53,19 +53,19 @@ discard block |
||
| 53 | 53 | * @throws Exceptions/PinterestExceptions |
| 54 | 54 | * @return Models\Pin |
| 55 | 55 | */ |
| 56 | - public function create( array $data ) |
|
| 56 | + public function create(array $data) |
|
| 57 | 57 | { |
| 58 | - if( array_key_exists("image", $data) ){ |
|
| 59 | - if(class_exists("\CURLFile")){ |
|
| 58 | + if (array_key_exists("image", $data)) { |
|
| 59 | + if (class_exists("\CURLFile")) { |
|
| 60 | 60 | $data["image"] = new \CURLFile($data['image']); |
| 61 | 61 | } |
| 62 | - else{ |
|
| 62 | + else { |
|
| 63 | 63 | $data["image"] = '@' . $data['image']; |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $response = $this->request->post( "pins", $data ); |
|
| 68 | - return new Pin( $this->master, $response ); |
|
| 67 | + $response = $this->request->post("pins", $data); |
|
| 68 | + return new Pin($this->master, $response); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | * @throws Exceptions/PinterestExceptions |
| 78 | 78 | * @return Models\Pin |
| 79 | 79 | */ |
| 80 | - public function update( $pin_id, array $data ) |
|
| 80 | + public function update($pin_id, array $data) |
|
| 81 | 81 | { |
| 82 | - $response = $this->request->update( sprintf("pins/%s", $pin_id), $data ); |
|
| 83 | - return new Pin( $this->master, $response ); |
|
| 82 | + $response = $this->request->update(sprintf("pins/%s", $pin_id), $data); |
|
| 83 | + return new Pin($this->master, $response); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | * @throws Exceptions/PinterestExceptions |
| 92 | 92 | * @return boolean |
| 93 | 93 | */ |
| 94 | - public function delete( $pin_id ) |
|
| 94 | + public function delete($pin_id) |
|
| 95 | 95 | { |
| 96 | - $this->request->delete( sprintf("pins/%s", $pin_id) ); |
|
| 96 | + $this->request->delete(sprintf("pins/%s", $pin_id)); |
|
| 97 | 97 | return true; |
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | \ No newline at end of file |