@@ -26,26 +26,26 @@ |
||
26 | 26 | * |
27 | 27 | * @return string|null |
28 | 28 | */ |
29 | - public function getUsername() : ?string; |
|
29 | + public function getUsername() : ? string; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Returns the full name bound to the Identity. |
33 | 33 | * |
34 | 34 | * @return string|null |
35 | 35 | */ |
36 | - public function getName() : ?string; |
|
36 | + public function getName() : ? string; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Returns the e-mail address bound to the Identity. |
40 | 40 | * |
41 | 41 | * @return string|null |
42 | 42 | */ |
43 | - public function getEmail() : ?string; |
|
43 | + public function getEmail() : ? string; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Returns the avatar URI bound to the Identity. |
47 | 47 | * |
48 | 48 | * @return string|null |
49 | 49 | */ |
50 | - public function getAvatar() : ?string; |
|
50 | + public function getAvatar() : ? string; |
|
51 | 51 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | protected function normalizeParameters(array $params) : array |
96 | 96 | { |
97 | 97 | // Recursively percent encode each key/value pair in the params. |
98 | - array_walk_recursive($params, function (&$key, &$value) { |
|
98 | + array_walk_recursive($params, function(&$key, &$value) { |
|
99 | 99 | $key = rawurlencode(rawurldecode($key)); |
100 | 100 | $value = rawurlencode(rawurldecode($value)); |
101 | 101 | }); |
@@ -152,6 +152,6 @@ discard block |
||
152 | 152 | { |
153 | 153 | // The joining ampersand after the encoded Client's secret is correctly left in even if no Token is being |
154 | 154 | // included in the key. |
155 | - return rawurlencode($client->getSecret()) . '&' . (isset($token) ? rawurlencode($token->getSecret()) : ''); |
|
155 | + return rawurlencode($client->getSecret()).'&'.(isset($token) ? rawurlencode($token->getSecret()) : ''); |
|
156 | 156 | } |
157 | 157 | } |
@@ -104,7 +104,7 @@ |
||
104 | 104 | * See the class description for which kind of additional options are supported/mandatory. |
105 | 105 | * |
106 | 106 | * @param callable $handler |
107 | - * @return callable |
|
107 | + * @return \Closure |
|
108 | 108 | */ |
109 | 109 | public function __invoke(callable $handler) : callable |
110 | 110 | { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function setMethod(string $method) : Authorization |
91 | 91 | { |
92 | - switch($method) { |
|
92 | + switch ($method) { |
|
93 | 93 | case self::METHOD_HEADER: |
94 | 94 | case self::METHOD_QUERY: |
95 | 95 | $this->method = $method; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function __invoke(callable $handler) : callable |
110 | 110 | { |
111 | - return function ($request, array& $stackOptions) use ($handler) { |
|
111 | + return function($request, array& $stackOptions) use ($handler) { |
|
112 | 112 | |
113 | 113 | // Skip to the next handler if we weren't asked to do any stuff. |
114 | 114 | if (!isset($stackOptions['oauth1'])) { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | // so we might just as well make all the parameters we gather and append more easily accessible |
120 | 120 | // by pushing into the $stackOptions directly in case there actually *are* handlers in the stack |
121 | 121 | // that have to do some post-processing after us. |
122 | - $handlerOptions =& $stackOptions['oauth1'] ?: $stackOptions['oauth1'] = []; |
|
122 | + $handlerOptions = & $stackOptions['oauth1'] ?: $stackOptions['oauth1'] = []; |
|
123 | 123 | |
124 | 124 | $this->parseOptions($handlerOptions); |
125 | 125 | $this->gatherAuthorizationParams($handlerOptions); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | // Unite our base parameters (which cannot be overridden) with the optional ones passed in. |
188 | 188 | $options['params'] = [ |
189 | 189 | 'oauth_version' => '1.0', |
190 | - 'oauth_consumer_key' => isset($options['client']) ? $options['client']->getId() : $this->client->getId(), |
|
190 | + 'oauth_consumer_key' => isset($options['client']) ? $options['client']->getId() : $this->client->getId(), |
|
191 | 191 | 'oauth_signature_method' => isset($options['signer']) ? $options['signer']->getMethod() : $this->signer->getMethod(), |
192 | 192 | 'oauth_nonce' => utils\Random::string(6, utils\str\Character::CHARS_BASE64, utils\Random::STRENGTH_NONE), |
193 | 193 | 'oauth_timestamp' => time(), |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $params[$key] = $key.'="'.rawurlencode($value).'"'; |
252 | 252 | } |
253 | 253 | |
254 | - return $request->withHeader('Authorization', 'OAuth ' . implode(', ', $params)); |
|
254 | + return $request->withHeader('Authorization', 'OAuth '.implode(', ', $params)); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | /** |
88 | 88 | * {@inheritDoc} |
89 | 89 | */ |
90 | - public function getUsername() : ?string |
|
90 | + public function getUsername() : ? string |
|
91 | 91 | { |
92 | 92 | return $this->username; |
93 | 93 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | /** |
96 | 96 | * {@inheritDoc} |
97 | 97 | */ |
98 | - public function getName() : ?string |
|
98 | + public function getName() : ? string |
|
99 | 99 | { |
100 | 100 | return $this->name; |
101 | 101 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | /** |
104 | 104 | * {@inheritDoc} |
105 | 105 | */ |
106 | - public function getEmail() : ?string |
|
106 | + public function getEmail() : ? string |
|
107 | 107 | { |
108 | 108 | return $this->email; |
109 | 109 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | /** |
112 | 112 | * {@inheritDoc} |
113 | 113 | */ |
114 | - public function getAvatar() : ?string |
|
114 | + public function getAvatar() : ? string |
|
115 | 115 | { |
116 | 116 | return $this->avatar; |
117 | 117 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return auth\Token |
110 | 110 | */ |
111 | - public function getRefreshToken() : ?auth\Token |
|
111 | + public function getRefreshToken() : ? auth\Token |
|
112 | 112 | { |
113 | 113 | return $this->refreshToken; |
114 | 114 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @return int |
140 | 140 | */ |
141 | - public function getExpiry() : ?int |
|
141 | + public function getExpiry() : ? int |
|
142 | 142 | { |
143 | 143 | return $this->expiry; |
144 | 144 | } |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | // Intercept the flow - instead of directly returning a Promise for the entity's identity data, |
51 | 51 | // we will now return a Promise that resolves once both the email and identity |
52 | 52 | // data have been resolved and the email has been mapped into the identity data. |
53 | - $promise = $this->getEmail($token)->then(function ($email) use ($token, $promise) { |
|
53 | + $promise = $this->getEmail($token)->then(function($email) use ($token, $promise) { |
|
54 | 54 | |
55 | 55 | // Map the e-mail address in once the identity data is available (has successfully resolved). |
56 | - return $promise->then(function (array $data) use ($token, $email) { |
|
56 | + return $promise->then(function(array $data) use ($token, $email) { |
|
57 | 57 | |
58 | 58 | $data['email'] = $email ?? $data['email']; |
59 | 59 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | }); |
63 | 63 | } |
64 | 64 | |
65 | - return $promise->then(function (array $data) use ($token) { |
|
65 | + return $promise->then(function(array $data) use ($token) { |
|
66 | 66 | return $this->createIdentity($token, $data); |
67 | 67 | }); |
68 | 68 | } |
@@ -43,9 +43,9 @@ |
||
43 | 43 | public function getIdentifyUrl() : string |
44 | 44 | { |
45 | 45 | $fields = [ |
46 | - 'id', 'first-name', 'last-name', 'formatted-name', |
|
47 | - 'email-address', 'headline', 'location', 'industry', |
|
48 | - 'public-profile-url', 'picture-url', |
|
46 | + 'id', 'first-name', 'last-name', 'formatted-name', |
|
47 | + 'email-address', 'headline', 'location', 'industry', |
|
48 | + 'public-profile-url', 'picture-url', |
|
49 | 49 | ]; |
50 | 50 | |
51 | 51 | // Talk about proprietary 'standards'... |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | // Intercept the flow - instead of directly returning a Promise for the entity's identity data, |
51 | 51 | // we will now return a Promise that resolves once both the email and identity |
52 | 52 | // data have been resolved and the email has been mapped into the identity data. |
53 | - $promise = $this->getEmail($token)->then(function ($email) use ($token, $promise) { |
|
53 | + $promise = $this->getEmail($token)->then(function($email) use ($token, $promise) { |
|
54 | 54 | |
55 | 55 | // Map the e-mail address in once the identity data is available (has successfully resolved). |
56 | - return $promise->then(function (array $data) use ($token, $email) { |
|
56 | + return $promise->then(function(array $data) use ($token, $email) { |
|
57 | 57 | |
58 | 58 | $data['email'] = $email ?? $data['email']; |
59 | 59 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | }); |
63 | 63 | } |
64 | 64 | |
65 | - return $promise->then(function (array $data) use ($token) { |
|
65 | + return $promise->then(function(array $data) use ($token) { |
|
66 | 66 | return $this->createIdentity($token, $data); |
67 | 67 | }); |
68 | 68 | } |
@@ -108,7 +108,7 @@ |
||
108 | 108 | public function request(string $method, string $url, auth\interfaces\Token $token = null, array $options = []) : Promise |
109 | 109 | { |
110 | 110 | return $this->getHttpClient()->requestAsync($method, $url, array_merge_recursive($this->getDefaultRequestOptions($token), $options))->then( |
111 | - function (Response $response) use($token) { |
|
111 | + function(Response $response) use($token) { |
|
112 | 112 | return $this->onRequestSuccess($response, $token); |
113 | 113 | }, |
114 | 114 | function(\Exception $exception) use($token) { |