@@ -51,7 +51,7 @@ |
||
51 | 51 | |
52 | 52 | $data = new Data\Collection($response); |
53 | 53 | |
54 | - if (!$data->exists('id')) { |
|
54 | + if ( ! $data->exists('id')) { |
|
55 | 55 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
56 | 56 | } |
57 | 57 |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | $data = new Data\Collection($response); |
68 | 68 | |
69 | - if (!$data->exists('response')) { |
|
69 | + if ( ! $data->exists('response')) { |
|
70 | 70 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
71 | 71 | } |
72 | 72 | |
@@ -81,14 +81,14 @@ discard block |
||
81 | 81 | $userProfile->city = $data->get('homeCity'); |
82 | 82 | $userProfile->email = $data->filter('contact')->get('email'); |
83 | 83 | $userProfile->emailVerified = $userProfile->email; |
84 | - $userProfile->profileURL = 'https://www.foursquare.com/user/' . $userProfile->identifier; |
|
85 | - $userProfile->displayName = trim($userProfile->firstName . ' ' . $userProfile->lastName); |
|
84 | + $userProfile->profileURL = 'https://www.foursquare.com/user/'.$userProfile->identifier; |
|
85 | + $userProfile->displayName = trim($userProfile->firstName.' '.$userProfile->lastName); |
|
86 | 86 | |
87 | 87 | if ($data->exists('photo')) { |
88 | 88 | $photoSize = $this->config->get('photo_size') ?: '150x150'; |
89 | 89 | |
90 | 90 | $userProfile->photoURL = $data->filter('photo')->get('prefix'); |
91 | - $userProfile->photoURL .= $photoSize . $data->filter('photo')->get('suffix'); |
|
91 | + $userProfile->photoURL .= $photoSize.$data->filter('photo')->get('suffix'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | return $userProfile; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | $data = new Data\Collection($response); |
105 | 105 | |
106 | - if (!$data->exists('response')) { |
|
106 | + if ( ! $data->exists('response')) { |
|
107 | 107 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
108 | 108 | } |
109 | 109 | |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | |
132 | 132 | $userContact->identifier = $item->get('id'); |
133 | 133 | $userContact->photoURL = $item->filter('photo')->get('prefix'); |
134 | - $userContact->photoURL .= $photoSize . $item->filter('photo')->get('suffix'); |
|
135 | - $userContact->displayName = trim($item->get('firstName') . ' ' . $item->get('lastName')); |
|
134 | + $userContact->photoURL .= $photoSize.$item->filter('photo')->get('suffix'); |
|
135 | + $userContact->displayName = trim($item->get('firstName').' '.$item->get('lastName')); |
|
136 | 136 | $userContact->email = $item->filter('contact')->get('email'); |
137 | 137 | |
138 | 138 | return $userContact; |
@@ -31,12 +31,12 @@ |
||
31 | 31 | { |
32 | 32 | parent::authenticateFinish(); |
33 | 33 | |
34 | - $userProfile = $this->storage->get($this->providerId . '.user'); |
|
34 | + $userProfile = $this->storage->get($this->providerId.'.user'); |
|
35 | 35 | |
36 | - $userProfile->identifier = !empty($userProfile->identifier) ? $userProfile->identifier : $userProfile->email; |
|
36 | + $userProfile->identifier = ! empty($userProfile->identifier) ? $userProfile->identifier : $userProfile->email; |
|
37 | 37 | $userProfile->emailVerified = $userProfile->email; |
38 | 38 | |
39 | 39 | // re store the user profile |
40 | - $this->storage->set($this->providerId . '.user', $userProfile); |
|
40 | + $this->storage->set($this->providerId.'.user', $userProfile); |
|
41 | 41 | } |
42 | 42 | } |
@@ -87,7 +87,7 @@ |
||
87 | 87 | 'access_token' => $this->getStoredData('access_token'), |
88 | 88 | ]); |
89 | 89 | |
90 | - if (!$response || !isset($response->items) || !isset($response->items[0])) { |
|
90 | + if ( ! $response || ! isset($response->items) || ! isset($response->items[0])) { |
|
91 | 91 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
92 | 92 | } |
93 | 93 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | $data = new Data\Collection($response); |
53 | 53 | |
54 | - if (!$data->exists('response')) { |
|
54 | + if ( ! $data->exists('response')) { |
|
55 | 55 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
56 | 56 | } |
57 | 57 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | ? ['type' => 'text', 'body' => $status] |
91 | 91 | : $status; |
92 | 92 | |
93 | - $response = $this->apiRequest('blog/' . $this->getStoredData('primary_blog') . '/post', 'POST', $status); |
|
93 | + $response = $this->apiRequest('blog/'.$this->getStoredData('primary_blog').'/post', 'POST', $status); |
|
94 | 94 | |
95 | 95 | return $response; |
96 | 96 | } |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * @return void |
22 | 22 | */ |
23 | 23 | spl_autoload_register( |
24 | - function ($class) { |
|
24 | + function($class) { |
|
25 | 25 | // project-specific namespace prefix. Will only kicks in for Hybridauth's namespace. |
26 | 26 | $prefix = 'Hybridauth\\'; |
27 | 27 | |
28 | 28 | // base directory for the namespace prefix. |
29 | - $base_dir = __DIR__; // By default, it points to this same folder. |
|
29 | + $base_dir = __DIR__; // By default, it points to this same folder. |
|
30 | 30 | // You may change this path if having trouble detecting the path to |
31 | 31 | // the source files. |
32 | 32 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | // replace the namespace prefix with the base directory, replace namespace |
44 | 44 | // separators with directory separators in the relative class name, append |
45 | 45 | // with .php |
46 | - $file = $base_dir . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $relative_class) . '.php'; |
|
46 | + $file = $base_dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $relative_class).'.php'; |
|
47 | 47 | |
48 | 48 | // if the file exists, require it |
49 | 49 | if (file_exists($file)) { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | throw new RuntimeException('HTTP headers already sent to browser and Hybridauth won\'t be able to start/resume PHP session. To resolve this, session_start() must be called before outputing any data.'); |
45 | 45 | } |
46 | 46 | |
47 | - if (!session_start()) { |
|
47 | + if ( ! session_start()) { |
|
48 | 48 | throw new RuntimeException('PHP session failed to start.'); |
49 | 49 | } |
50 | 50 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function get($key) |
56 | 56 | { |
57 | - $key = $this->keyPrefix . strtolower($key); |
|
57 | + $key = $this->keyPrefix.strtolower($key); |
|
58 | 58 | |
59 | 59 | if (isset($_SESSION[$this->storeNamespace], $_SESSION[$this->storeNamespace][$key])) { |
60 | 60 | $value = $_SESSION[$this->storeNamespace][$key]; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function set($key, $value) |
76 | 76 | { |
77 | - $key = $this->keyPrefix . strtolower($key); |
|
77 | + $key = $this->keyPrefix.strtolower($key); |
|
78 | 78 | |
79 | 79 | if (is_object($value)) { |
80 | 80 | // We encapsulate as our classes may be defined after session is initialized. |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function delete($key) |
99 | 99 | { |
100 | - $key = $this->keyPrefix . strtolower($key); |
|
100 | + $key = $this->keyPrefix.strtolower($key); |
|
101 | 101 | |
102 | 102 | if (isset($_SESSION[$this->storeNamespace], $_SESSION[$this->storeNamespace][$key])) { |
103 | 103 | $tmp = $_SESSION[$this->storeNamespace]; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function deleteMatch($key) |
115 | 115 | { |
116 | - $key = $this->keyPrefix . strtolower($key); |
|
116 | + $key = $this->keyPrefix.strtolower($key); |
|
117 | 117 | |
118 | 118 | if (isset($_SESSION[$this->storeNamespace]) && count($_SESSION[$this->storeNamespace])) { |
119 | 119 | $tmp = $_SESSION[$this->storeNamespace]; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $collection = parent::validateAccessTokenExchange($response); |
64 | 64 | |
65 | - if (!$collection->exists('expires_in')) { |
|
65 | + if ( ! $collection->exists('expires_in')) { |
|
66 | 66 | // Instagram tokens always expire in an hour, but this is implicit not explicit |
67 | 67 | |
68 | 68 | $expires_in = 60 * 60; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function maintainToken() |
93 | 93 | { |
94 | - if (!$this->isConnected()) { |
|
94 | + if ( ! $this->isConnected()) { |
|
95 | 95 | return; |
96 | 96 | } |
97 | 97 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $exchange_by_expiry_days = $this->config->get('exchange_by_expiry_days') ?: 45; |
100 | 100 | if ($exchange_by_expiry_days !== null) { |
101 | 101 | $projected_timestamp = time() + 60 * 60 * 24 * $exchange_by_expiry_days; |
102 | - if (!$this->hasAccessTokenExpired() && $this->hasAccessTokenExpired($projected_timestamp)) { |
|
102 | + if ( ! $this->hasAccessTokenExpired() && $this->hasAccessTokenExpired($projected_timestamp)) { |
|
103 | 103 | $this->exchangeAccessToken(); |
104 | 104 | } |
105 | 105 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | ]); |
145 | 145 | |
146 | 146 | $data = new Collection($response); |
147 | - if (!$data->exists('id')) { |
|
147 | + if ( ! $data->exists('id')) { |
|
148 | 148 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
149 | 149 | } |
150 | 150 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $response = $this->apiRequest('me/media', 'GET', $params); |
201 | 201 | |
202 | 202 | $data = new Collection($response); |
203 | - if (!$data->exists('data')) { |
|
203 | + if ( ! $data->exists('data')) { |
|
204 | 204 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
205 | 205 | } |
206 | 206 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | ]); |
241 | 241 | |
242 | 242 | $data = new Collection($response); |
243 | - if (!$data->exists('id')) { |
|
243 | + if ( ! $data->exists('id')) { |
|
244 | 244 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
245 | 245 | } |
246 | 246 |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | $data = new Data\Collection($response); |
117 | 117 | |
118 | - if (!$data->exists('openid')) { |
|
118 | + if ( ! $data->exists('openid')) { |
|
119 | 119 | throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
120 | 120 | } |
121 | 121 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $userProfile->region = $data->get('province'); |
129 | 129 | $userProfile->country = $data->get('country'); |
130 | 130 | $genders = ['', 'male', 'female']; |
131 | - $userProfile->gender = $genders[(int)$data->get('sex')]; |
|
131 | + $userProfile->gender = $genders[(int) $data->get('sex')]; |
|
132 | 132 | |
133 | 133 | return $userProfile; |
134 | 134 | } |