@@ -63,10 +63,10 @@ |
||
| 63 | 63 | $request = $helper->request($this->instagram->getHttpClient(), $endpoint, $this->params, $this->method); |
| 64 | 64 | |
| 65 | 65 | if ($request === null) { |
| 66 | - throw new InstagramResponseException("400 Bad Request: instanceof InstagramResponse cannot be null", 400); |
|
| 66 | + throw new InstagramResponseException("400 Bad Request: instanceof InstagramResponse cannot be null", 400); |
|
| 67 | 67 | } |
| 68 | - $this->response = new InstagramResponse($request); |
|
| 69 | - $this->xRateLimitRemaining = $this->response->getHeader('X-Ratelimit-Remaining'); |
|
| 68 | + $this->response = new InstagramResponse($request); |
|
| 69 | + $this->xRateLimitRemaining = $this->response->getHeader('X-Ratelimit-Remaining'); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /* |
@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | class HelperFactory |
| 13 | 13 | { |
| 14 | - /** @var Singleton The reference to *Singleton* instance of this class */ |
|
| 15 | - private static $instance; |
|
| 14 | + /** @var Singleton The reference to *Singleton* instance of this class */ |
|
| 15 | + private static $instance; |
|
| 16 | 16 | |
| 17 | 17 | /** @var Response $response */ |
| 18 | 18 | protected static $response; |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | /** @var object $content */ |
| 24 | 24 | protected static $content; |
| 25 | 25 | |
| 26 | - /* |
|
| 26 | + /* |
|
| 27 | 27 | * Returns the *Singleton* instance of this class. |
| 28 | 28 | * |
| 29 | 29 | * @return Singleton The *Singleton* instance. |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | return static::$instance; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - /* |
|
| 40 | + /* |
|
| 41 | 41 | * Protected constructor to prevent creating a new instance of the |
| 42 | 42 | * *Singleton* via the `new` operator from outside of this class. |
| 43 | 43 | */ |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $exception |
| 108 | 108 | ); |
| 109 | 109 | } |
| 110 | - return json_decode(self::$content); |
|
| 110 | + return json_decode(self::$content); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /* |
@@ -139,13 +139,13 @@ discard block |
||
| 139 | 139 | protected static function getExceptionMessage(\stdClass $object) |
| 140 | 140 | { |
| 141 | 141 | $message = array(); |
| 142 | - $message['error_type'] = isset($object->meta) ? $object->meta->error_type : $object->error_type; |
|
| 143 | - $message['error_message'] = isset($object->meta) ? $object->meta->error_message : $object->error_message; |
|
| 144 | - $message['error_code'] = isset($object->meta) ? $object->meta->code : $object->code; |
|
| 142 | + $message['error_type'] = isset($object->meta) ? $object->meta->error_type : $object->error_type; |
|
| 143 | + $message['error_message'] = isset($object->meta) ? $object->meta->error_message : $object->error_message; |
|
| 144 | + $message['error_code'] = isset($object->meta) ? $object->meta->code : $object->code; |
|
| 145 | 145 | return $message; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - /* |
|
| 148 | + /* |
|
| 149 | 149 | * Private clone method to prevent cloning of the instance of the |
| 150 | 150 | * *Singleton* instance. |
| 151 | 151 | * |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | if (!is_array($config)) { |
| 59 | 59 | throw new InstagramException('Invalid Instagram Configuration data', 400); |
| 60 | 60 | } |
| 61 | - $this->setClientId($config['ClientId']); |
|
| 62 | - $this->setClientSecret($config['ClientSecret']); |
|
| 63 | - $this->setCallbackUrl($config['Callback']); |
|
| 64 | - $this->state = isset($config['State']) ? $config['State'] : substr(md5(rand()), 0, 7); |
|
| 65 | - $helper = HelperFactory::getInstance(); |
|
| 61 | + $this->setClientId($config['ClientId']); |
|
| 62 | + $this->setClientSecret($config['ClientSecret']); |
|
| 63 | + $this->setCallbackUrl($config['Callback']); |
|
| 64 | + $this->state = isset($config['State']) ? $config['State'] : substr(md5(rand()), 0, 7); |
|
| 65 | + $helper = HelperFactory::getInstance(); |
|
| 66 | 66 | $this->client = $helper->client(Constants::API_HOST); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | throw new InstagramException("Missing or Invalid Scope permission used", 400); |
| 78 | 78 | } |
| 79 | 79 | if (count(array_diff($parameters['scope'], $this->defaultScopes)) !== 0) { |
| 80 | - throw new InstagramException("Missing or Invalid Scope permission used", 400); |
|
| 80 | + throw new InstagramException("Missing or Invalid Scope permission used", 400); |
|
| 81 | 81 | } |
| 82 | - $this->scopes = $parameters['scope']; |
|
| 82 | + $this->scopes = $parameters['scope']; |
|
| 83 | 83 | $query = 'client_id='.$this->getClientId().'&redirect_uri='.urlencode($this->getCallbackUrl()).'&response_type=code&state='.$this->state; |
| 84 | 84 | $query .= isset($this->scopes) ? '&scope='.urlencode(str_replace(",", " ", implode(",", $parameters['scope']))) : ''; |
| 85 | 85 | return sprintf('%s%s?%s', Constants::API_HOST, Constants::API_AUTH, $query); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | "code" => $code, |
| 101 | 101 | "state" => $this->state |
| 102 | 102 | ); |
| 103 | - $helper = HelperFactory::getInstance(); |
|
| 103 | + $helper = HelperFactory::getInstance(); |
|
| 104 | 104 | $response = $helper->request($this->client, Constants::API_TOKEN, $options, 'POST'); |
| 105 | 105 | $this->oauthResponse = new InstagramOAuth( |
| 106 | 106 | json_decode($response->getBody()->getContents()) |
@@ -174,8 +174,8 @@ discard block |
||
| 174 | 174 | if ($this->oauthResponse instanceof InstagramOAuth) { |
| 175 | 175 | return $this->oauthResponse; |
| 176 | 176 | } |
| 177 | - $this->oauthResponse = new InstagramOAuth(json_decode(json_encode(["access_token" => null]))); |
|
| 178 | - return $this->oauthResponse; |
|
| 177 | + $this->oauthResponse = new InstagramOAuth(json_decode(json_encode(["access_token" => null]))); |
|
| 178 | + return $this->oauthResponse; |
|
| 179 | 179 | } |
| 180 | 180 | /* |
| 181 | 181 | * @return Client |