@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Haridarshan\Instagram; |
| 3 | 3 | |
| 4 | -class InstagramException extends \Exception{ |
|
| 4 | +class InstagramException extends \Exception { |
|
| 5 | 5 | |
| 6 | 6 | } |
@@ -355,6 +355,10 @@ discard block |
||
| 355 | 355 | * Getter: Client Id |
| 356 | 356 | * @return: string |
| 357 | 357 | */ |
| 358 | + |
|
| 359 | + /** |
|
| 360 | + * @return string |
|
| 361 | + */ |
|
| 358 | 362 | public function getClientSecret() { |
| 359 | 363 | return $this->client_secret; |
| 360 | 364 | } |
@@ -372,6 +376,10 @@ discard block |
||
| 372 | 376 | * Getter: Callback Url |
| 373 | 377 | * @return: string |
| 374 | 378 | */ |
| 379 | + |
|
| 380 | + /** |
|
| 381 | + * @return string |
|
| 382 | + */ |
|
| 375 | 383 | public function getCallbackUrl() { |
| 376 | 384 | return $this->callback_url; |
| 377 | 385 | } |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | - * Make URLs for user browser navigation. |
|
| 133 | - * |
|
| 134 | - * @param string $path |
|
| 135 | - * @param array $parameters |
|
| 136 | - * |
|
| 137 | - * @return string |
|
| 138 | - */ |
|
| 132 | + * Make URLs for user browser navigation. |
|
| 133 | + * |
|
| 134 | + * @param string $path |
|
| 135 | + * @param array $parameters |
|
| 136 | + * |
|
| 137 | + * @return string |
|
| 138 | + */ |
|
| 139 | 139 | public function getUrl($path, array $parameters) { |
| 140 | 140 | if (is_array($parameters)) { |
| 141 | 141 | if (isset($parameters['scope']) && count(array_diff($parameters['scope'], $this->default_scopes)) === 0) { |
@@ -426,19 +426,19 @@ discard block |
||
| 426 | 426 | * |
| 427 | 427 | * @return void |
| 428 | 428 | */ |
| 429 | - private function setAccessToken($data) { |
|
| 430 | - $token = is_object($data) ? $data->access_token : $data; |
|
| 431 | - $this->access_token = $token; |
|
| 432 | - } |
|
| 429 | + private function setAccessToken($data) { |
|
| 430 | + $token = is_object($data) ? $data->access_token : $data; |
|
| 431 | + $this->access_token = $token; |
|
| 432 | + } |
|
| 433 | 433 | |
| 434 | 434 | /* |
| 435 | 435 | * Getter: User Access Token |
| 436 | 436 | * |
| 437 | 437 | * @return string |
| 438 | 438 | */ |
| 439 | - public function getAccessToken() { |
|
| 440 | - return $this->access_token; |
|
| 441 | - } |
|
| 439 | + public function getAccessToken() { |
|
| 440 | + return $this->access_token; |
|
| 441 | + } |
|
| 442 | 442 | |
| 443 | 443 | /* |
| 444 | 444 | * Get a string containing the version of the library. |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | throw new InstagramException("Missing or Invalid Scope permission used"); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - $query = 'client_id='. $this->getClientId() .'&redirect_uri='. urlencode($this->getCallbackUrl()) .'&response_type=code'; |
|
| 147 | + $query = 'client_id='.$this->getClientId().'&redirect_uri='.urlencode($this->getCallbackUrl()).'&response_type=code'; |
|
| 148 | 148 | |
| 149 | 149 | if (isset($this->scopes)) { |
| 150 | 150 | $scope = urlencode(str_replace(",", " ", implode(",", $parameters['scope']))); |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $this->execute($path, $options, 'POST'); |
| 182 | 182 | |
| 183 | 183 | if (isset($this->response->code)) { |
| 184 | - throw new InstagramException("return status code: ". $this->response->code ." type: ". $this->response->error_type ." message: ". $this->response->error_message ); |
|
| 184 | + throw new InstagramException("return status code: ".$this->response->code." type: ".$this->response->error_type." message: ".$this->response->error_message); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | $this->setAccessToken($this->response); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $signature = $endpoint; |
| 271 | 271 | ksort($params); |
| 272 | 272 | |
| 273 | - foreach($params as $key => $value) { |
|
| 273 | + foreach ($params as $key => $value) { |
|
| 274 | 274 | $signature .= "|$key=$value"; |
| 275 | 275 | } |
| 276 | 276 | |
@@ -299,24 +299,24 @@ discard block |
||
| 299 | 299 | throw new InstagramException("$path - api requires an authenticated users access token."); |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | - $authentication_method = '?access_token=' . $this->access_token; |
|
| 302 | + $authentication_method = '?access_token='.$this->access_token; |
|
| 303 | 303 | // Need to remove the access_token from $params array |
| 304 | 304 | unset($params['access_token']); |
| 305 | 305 | } else { |
| 306 | - $authentication_method = '?client_id=' . $this->getClientId(); |
|
| 306 | + $authentication_method = '?client_id='.$this->getClientId(); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | // This portion needs modification |
| 310 | 310 | $param = null; |
| 311 | 311 | |
| 312 | 312 | if (isset($params) && is_array($params)) { |
| 313 | - $param = '&' . http_build_query($params); |
|
| 313 | + $param = '&'.http_build_query($params); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - $endpoint = self::API_VERSION. $path . $authentication_method . (('GET' === $method) ? $param : null); |
|
| 316 | + $endpoint = self::API_VERSION.$path.$authentication_method.(('GET' === $method) ? $param : null); |
|
| 317 | 317 | |
| 318 | 318 | if ($this->secure) { |
| 319 | - $endpoint .= (strstr($endpoint, '?') ? '&' : '?') . 'sig=' . $this->secureRequest($path, $authentication_method, $data); |
|
| 319 | + $endpoint .= (strstr($endpoint, '?') ? '&' : '?').'sig='.$this->secureRequest($path, $authentication_method, $data); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | $this->execute($endpoint, $data); |