Completed
Push — master ( a2309d...de4682 )
by Haridarshan
02:35
created
src/Instagram.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
     /**
74 74
      * Default Constructor
75 75
      * Instagram Configuration Data
76
-	 *
76
+     *
77 77
      * @param array $config
78
-	 *
79
-	 * @throws InstagramException|InvalidArgumentException
80
-	 * 
81
-	 * @todo validate callback url
78
+     *
79
+     * @throws InstagramException|InvalidArgumentException
80
+     * 
81
+     * @todo validate callback url
82 82
      */
83 83
     public function __construct(array $config = [])
84 84
     {
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
             throw new InstagramException('Invalid Instagram Configuration data');
87 87
         }
88 88
 		
89
-		if (!$config['ClientId']) {
89
+        if (!$config['ClientId']) {
90 90
             throw new InstagramException('Missing "ClientId" key not supplied in config');
91 91
         }
92 92
 		
93
-		if (!$config['ClientSecret']) {
93
+        if (!$config['ClientSecret']) {
94 94
             throw new InstagramException('Missing "ClientSecret" key not supplied in config');
95 95
         }
96 96
 		
97
-		$this->app = new InstagramApp($config['ClientId'], $config['ClientSecret']);	
97
+        $this->app = new InstagramApp($config['ClientId'], $config['ClientSecret']);	
98 98
 		
99 99
         $this->setCallbackUrl($config['Callback']);
100 100
         $this->state = isset($config['State']) ? $config['State'] : substr(md5(rand()), 0, 7);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         $this->client = HelperFactory::getInstance()->client(Constants::API_HOST);
103 103
     }
104 104
 	
105
-	/**
105
+    /**
106 106
      * Returns InstagramApp entity.
107 107
      *
108 108
      * @return InstagramApp
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
 	
115 115
     /**
116 116
      * Make URLs for user browser navigation
117
-	 *
117
+     *
118 118
      * @param array  $parameters
119
-	 *
119
+     *
120 120
      * @return string
121
-	 *
122
-	 * @throws InstagramException
121
+     *
122
+     * @throws InstagramException
123 123
      */
124 124
     public function getLoginUrl(array $parameters)
125 125
     {
@@ -132,21 +132,21 @@  discard block
 block discarded – undo
132 132
 		
133 133
         $this->scopes = $parameters['scope'];
134 134
 		
135
-		$loginUrl = new LoginUrl(
136
-			$this->getApp(),
137
-			$this->getCallbackUrl(),
138
-			$this->getState(),
139
-			$this->scopes
140
-		);
135
+        $loginUrl = new LoginUrl(
136
+            $this->getApp(),
137
+            $this->getCallbackUrl(),
138
+            $this->getState(),
139
+            $this->scopes
140
+        );
141 141
 		
142
-		return $loginUrl->loginUrl();
142
+        return $loginUrl->loginUrl();
143 143
     }
144 144
 	
145 145
     /**
146 146
      * Get the Oauth Access Token of a user from callback code
147
-	 *
147
+     *
148 148
      * @param string $code - Oauth2 Code returned with callback url after successfull login
149
-	 *
149
+     *
150 150
      * @return InstagramOAuth
151 151
      */
152 152
     public function oauth($code)
@@ -160,20 +160,20 @@  discard block
 block discarded – undo
160 160
             "state" => $this->state
161 161
         );
162 162
 		
163
-		$response = HelperFactory::getInstance()->request($this->client, Constants::API_TOKEN, $options, 'POST');
163
+        $response = HelperFactory::getInstance()->request($this->client, Constants::API_TOKEN, $options, 'POST');
164 164
 		
165 165
         $this->oauthResponse = new InstagramOAuth(
166
-			json_decode($response->getBody()->getContents())
167
-		);
166
+            json_decode($response->getBody()->getContents())
167
+        );
168 168
 		
169 169
         return $this->oauthResponse;
170 170
     }
171 171
 	
172 172
     /**
173 173
      * Setter: Callback Url
174
-	 *
174
+     *
175 175
      * @param string $url
176
-	 *
176
+     *
177 177
      * @return void
178 178
      */
179 179
     public function setCallbackUrl($url)
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	
184 184
     /**
185 185
      * Getter: Callback Url
186
-	 *
186
+     *
187 187
      * @return string
188 188
      */
189 189
     public function getCallbackUrl()
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	
194 194
     /**
195 195
      * Get InstagramOAuth
196
-	 *
196
+     *
197 197
      * @return InstagramOAuth
198 198
      */
199 199
     public function getOAuth()
@@ -202,16 +202,16 @@  discard block
 block discarded – undo
202 202
             return $this->oauthResponse;
203 203
         }
204 204
 		
205
-		$accessToken = new stdClass;
206
-		$accessToken->access_token = null;
205
+        $accessToken = new stdClass;
206
+        $accessToken->access_token = null;
207 207
 		
208 208
         $this->oauthResponse = new InstagramOAuth($accessToken);
209 209
         return $this->oauthResponse;
210 210
     }
211 211
 	
212 212
     /**
213
-	 * Get Http Client
214
-	 *
213
+     * Get Http Client
214
+     *
215 215
      * @return Client
216 216
      */
217 217
     public function getHttpClient()
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 	
222 222
     /**
223 223
      * Set User Access Token
224
-	 *
224
+     *
225 225
      * @param string $token
226
-	 *
226
+     *
227 227
      * @return void
228 228
      */
229 229
     public function setAccessToken($token)
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	
236 236
     /**
237 237
      * Get state value
238
-	 *
238
+     *
239 239
      * @return string|mixed
240 240
      */
241 241
     public function getState()
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 
246 246
     /**
247 247
      * Get a string containing the version of the library.
248
-	 *
248
+     *
249 249
      * @return string
250 250
      */
251 251
     public function getLibraryVersion()
Please login to merge, or discard this patch.