@@ -11,7 +11,6 @@ |
||
11 | 11 | namespace DirkGroenen\Pinterest\Endpoints; |
12 | 12 | |
13 | 13 | use DirkGroenen\Pinterest\Models\Board; |
14 | -use DirkGroenen\Pinterest\Models\Collection; |
|
15 | 14 | |
16 | 15 | class Boards extends Endpoint { |
17 | 16 |
@@ -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 | - $response = $this->request->delete( sprintf("boards/%s", $board_id) ); |
|
57 | + $response = $this->request->delete(sprintf("boards/%s", $board_id)); |
|
58 | 58 | return true; |
59 | 59 | } |
60 | 60 | } |
61 | 61 | \ No newline at end of file |
@@ -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 |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | * @param CurlBuilder $curl |
37 | 37 | * @param curl $curl |
38 | 38 | */ |
39 | - public function __construct( $response, CurlBuilder $curl ) |
|
39 | + public function __construct($response, CurlBuilder $curl) |
|
40 | 40 | { |
41 | 41 | $this->response = $response; |
42 | 42 | $this->curl = $curl; |
43 | 43 | |
44 | - if( is_string($response) ){ |
|
44 | + if (is_string($response)) { |
|
45 | 45 | $this->response = $this->decodeString($response); |
46 | 46 | } |
47 | 47 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param string $response |
54 | 54 | * @return array |
55 | 55 | */ |
56 | - private function decodeString( $response ) |
|
56 | + private function decodeString($response) |
|
57 | 57 | { |
58 | 58 | return json_decode($response, true); |
59 | 59 | } |
@@ -10,8 +10,6 @@ |
||
10 | 10 | |
11 | 11 | namespace DirkGroenen\Pinterest\Utils; |
12 | 12 | |
13 | -use DirkGroenen\Pinterest\Exceptions\PinterestException; |
|
14 | - |
|
15 | 13 | class CurlBuilder { |
16 | 14 | |
17 | 15 | /** |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | * @param string $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 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | //curl_setopt($rch, CURLOPT_NOBODY, true); |
204 | 204 | curl_setopt($rch, CURLOPT_FORBID_REUSE, false); |
205 | 205 | |
206 | - do{ |
|
206 | + do { |
|
207 | 207 | curl_setopt($rch, CURLOPT_URL, $newurl); |
208 | 208 | $response = curl_exec($rch); |
209 | 209 | |
@@ -211,29 +211,29 @@ discard block |
||
211 | 211 | $header = substr($response, 0, $header_size); |
212 | 212 | $body = substr($response, $header_size); |
213 | 213 | |
214 | - if(curl_errno($rch)){ |
|
214 | + if (curl_errno($rch)) { |
|
215 | 215 | $code = 0; |
216 | 216 | } |
217 | - else{ |
|
217 | + else { |
|
218 | 218 | $code = curl_getinfo($rch, CURLINFO_HTTP_CODE); |
219 | 219 | |
220 | 220 | if ($code == 301 || $code == 302) { |
221 | 221 | preg_match('/Location:(.*?)\n/i', $header, $matches); |
222 | 222 | $newurl = trim(array_pop($matches)); |
223 | 223 | } |
224 | - else{ |
|
224 | + else { |
|
225 | 225 | $code = 0; |
226 | 226 | } |
227 | 227 | } |
228 | - } while($code && --$mr); |
|
228 | + } while ($code && --$mr); |
|
229 | 229 | |
230 | 230 | curl_close($rch); |
231 | 231 | |
232 | - if(!$mr){ |
|
233 | - if ($maxredirect === null){ |
|
232 | + if (!$mr) { |
|
233 | + if ($maxredirect === null) { |
|
234 | 234 | trigger_error('Too many redirects.', E_USER_WARNING); |
235 | 235 | } |
236 | - else{ |
|
236 | + else { |
|
237 | 237 | $maxredirect = 0; |
238 | 238 | } |
239 | 239 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | } |
247 | 247 | |
248 | - if (!$body){ |
|
248 | + if (!$body) { |
|
249 | 249 | curl_setopt($this->curl, CURLOPT_HEADER, true); |
250 | 250 | $response = curl_exec($this->curl); |
251 | 251 |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function __construct($client_id, $client_secret, $curlbuilder = null) |
57 | 57 | { |
58 | - if($curlbuilder == null) |
|
58 | + if ($curlbuilder == null) |
|
59 | 59 | $curlbuilder = new CurlBuilder(); |
60 | 60 | |
61 | 61 | // Create new instance of Transport\Request |
62 | - $this->request = new Request( $curlbuilder ); |
|
62 | + $this->request = new Request($curlbuilder); |
|
63 | 63 | |
64 | 64 | // Create and set new instance of the OAuth class |
65 | 65 | $this->auth = new PinterestOAuth($client_id, $client_secret, $this->request); |
@@ -79,15 +79,15 @@ discard block |
||
79 | 79 | $class = "\\DirkGroenen\\Pinterest\\Endpoints\\" . ucfirst($endpoint); |
80 | 80 | |
81 | 81 | // Check if an instance has already been initiated |
82 | - if(!isset($this->cachedEndpoints[$endpoint])){ |
|
82 | + if (!isset($this->cachedEndpoints[$endpoint])) { |
|
83 | 83 | // Check endpoint existence |
84 | - if(!class_exists($class)) |
|
84 | + if (!class_exists($class)) |
|
85 | 85 | throw new InvalidEndpointException; |
86 | 86 | |
87 | 87 | // Create a reflection of the called class and initialize it |
88 | 88 | // with a reference to the request class |
89 | 89 | $ref = new \ReflectionClass($class); |
90 | - $obj = $ref->newInstanceArgs([ $this->request, $this ]); |
|
90 | + $obj = $ref->newInstanceArgs([$this->request, $this]); |
|
91 | 91 | |
92 | 92 | $this->cachedEndpoints[$endpoint] = $obj; |
93 | 93 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param string $client_id |
56 | 56 | * @param string $client_secret |
57 | 57 | */ |
58 | - public function __construct( $client_id, $client_secret, $request ) |
|
58 | + public function __construct($client_id, $client_secret, $request) |
|
59 | 59 | { |
60 | 60 | $this->client_id = $client_id; |
61 | 61 | $this->client_secret = $client_secret; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param string $redirect_uri |
76 | 76 | * @return string |
77 | 77 | */ |
78 | - public function getLoginUrl( $redirect_uri, $scopes = array("read_public"), $response_type = "code" ) |
|
78 | + public function getLoginUrl($redirect_uri, $scopes = array("read_public"), $response_type = "code") |
|
79 | 79 | { |
80 | 80 | $queryparams = array( |
81 | 81 | "response_type" => $response_type, |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | ); |
88 | 88 | |
89 | 89 | // Build url and return it |
90 | - return sprintf( "%s?%s", self::AUTH_HOST, http_build_query($queryparams) ); |
|
90 | + return sprintf("%s?%s", self::AUTH_HOST, http_build_query($queryparams)); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | private function generateState() |
100 | 100 | { |
101 | - return substr( md5( rand() ), 0, 7 ); |
|
101 | + return substr(md5(rand()), 0, 7); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @param string $code |
129 | 129 | * @return array |
130 | 130 | */ |
131 | - public function getOAuthToken( $code ) |
|
131 | + public function getOAuthToken($code) |
|
132 | 132 | { |
133 | 133 | // Build data array |
134 | 134 | $data = array( |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @param string $access_token |
152 | 152 | * @return void |
153 | 153 | */ |
154 | - public function setOAuthToken( $access_token ) |
|
154 | + public function setOAuthToken($access_token) |
|
155 | 155 | { |
156 | 156 | $this->request->setAccessToken($access_token); |
157 | 157 | } |
@@ -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 |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | * @throws Exceptions/PinterestExceptions |
24 | 24 | * @return Models\User |
25 | 25 | */ |
26 | - public function me( array $data = [] ) |
|
26 | + public function me(array $data = []) |
|
27 | 27 | { |
28 | - $response = $this->request->get("me", $data ); |
|
29 | - return new User( $this->master, $response ); |
|
28 | + $response = $this->request->get("me", $data); |
|
29 | + return new User($this->master, $response); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | * @throws Exceptions/PinterestExceptions |
39 | 39 | * @return Models\User |
40 | 40 | */ |
41 | - public function find( $username, array $data = [] ) |
|
41 | + public function find($username, array $data = []) |
|
42 | 42 | { |
43 | - $response = $this->request->get( sprintf("users/%s", $username), $data ); |
|
44 | - return new User( $this->master, $response ); |
|
43 | + $response = $this->request->get(sprintf("users/%s", $username), $data); |
|
44 | + return new User($this->master, $response); |
|
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 getMePins( array $data = [] ) |
|
55 | + public function getMePins(array $data = []) |
|
56 | 56 | { |
57 | - $response = $this->request->get( "me/pins", $data ); |
|
58 | - return new Collection( $this->master, $response, "Pin" ); |
|
57 | + $response = $this->request->get("me/pins", $data); |
|
58 | + return new Collection($this->master, $response, "Pin"); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | * @throws Exceptions/PinterestExceptions |
67 | 67 | * @return Collection |
68 | 68 | */ |
69 | - public function searchMePins( $query, array $data = [] ) |
|
69 | + public function searchMePins($query, array $data = []) |
|
70 | 70 | { |
71 | 71 | $data["query"] = $query; |
72 | - $response = $this->request->get( "me/search/pins", $data ); |
|
73 | - return new Collection( $this->master, $response, "Pin" ); |
|
72 | + $response = $this->request->get("me/search/pins", $data); |
|
73 | + return new Collection($this->master, $response, "Pin"); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | * @throws Exceptions/PinterestExceptions |
82 | 82 | * @return Collection |
83 | 83 | */ |
84 | - public function searchMeBoards( $query, array $data = [] ) |
|
84 | + public function searchMeBoards($query, array $data = []) |
|
85 | 85 | { |
86 | 86 | $data["query"] = $query; |
87 | 87 | |
88 | - $response = $this->request->get( "me/search/boards", $data ); |
|
89 | - return new Collection( $this->master, $response, "Board" ); |
|
88 | + $response = $this->request->get("me/search/boards", $data); |
|
89 | + return new Collection($this->master, $response, "Board"); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | * @throws Exceptions/PinterestExceptions |
98 | 98 | * @return Collection |
99 | 99 | */ |
100 | - public function getMeBoards( array $data = [] ) |
|
100 | + public function getMeBoards(array $data = []) |
|
101 | 101 | { |
102 | - $response = $this->request->get( "me/boards", $data ); |
|
103 | - return new Collection( $this->master, $response, "Board" ); |
|
102 | + $response = $this->request->get("me/boards", $data); |
|
103 | + return new Collection($this->master, $response, "Board"); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | * @throws Exceptions/PinterestExceptions |
112 | 112 | * @return Collection |
113 | 113 | */ |
114 | - public function getMeLikes( array $data = [] ) |
|
114 | + public function getMeLikes(array $data = []) |
|
115 | 115 | { |
116 | - $response = $this->request->get( "me/likes", $data ); |
|
117 | - return new Collection( $this->master, $response, "Pin" ); |
|
116 | + $response = $this->request->get("me/likes", $data); |
|
117 | + return new Collection($this->master, $response, "Pin"); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function getMeFollowers(array $data = []) |
129 | 129 | { |
130 | - $response = $this->request->get( "me/followers", $data ); |
|
131 | - return new Collection( $this->master, $response, "User" ); |
|
130 | + $response = $this->request->get("me/followers", $data); |
|
131 | + return new Collection($this->master, $response, "User"); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | } |
@@ -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 | - $user = $this->request->post( "me/following/users", array( |
|
71 | + $user = $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 | - $user = $this->request->delete( sprintf("me/following/users/%s", $user) ); |
|
87 | + $user = $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 | - $user = $this->request->post( "me/following/boards", array( |
|
101 | + $user = $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 | - $user = $this->request->delete( sprintf("me/following/boards/%s", $board_id) ); |
|
117 | + $user = $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 | - $user = $this->request->post( "me/following/interests", array( |
|
131 | + $user = $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 | - $user = $this->request->delete( sprintf("me/following/interests/%s", $interest_id) ); |
|
147 | + $user = $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 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | * @param Pinterest $master |
38 | 38 | * @return void |
39 | 39 | */ |
40 | - public function __construct( Request $request, Pinterest $master ) |
|
40 | + public function __construct(Request $request, Pinterest $master) |
|
41 | 41 | { |
42 | 42 | $this->request = $request; |
43 | 43 | $this->master = $master; |
@@ -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 | - $response = $this->request->delete( sprintf("pins/%s", $pin_id) ); |
|
96 | + $response = $this->request->delete(sprintf("pins/%s", $pin_id)); |
|
97 | 97 | return true; |
98 | 98 | } |
99 | 99 | } |
100 | 100 | \ No newline at end of file |