@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * {@inheritDoc} |
| 19 | 19 | */ |
| 20 | - protected function getDimensions() : ?array |
|
| 20 | + protected function getDimensions() : ? array |
|
| 21 | 21 | { |
| 22 | 22 | // Query stty first, then fall back to tput. |
| 23 | 23 | if (null === $dimensions = $this->getDimensionsFromStty()) { |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @return array Either an array containing two keys - 'width' and 'height' or null if the data couldn't |
| 39 | 39 | * be parsed to retrieve anything useful. |
| 40 | 40 | */ |
| 41 | - protected function getDimensionsFromStty() : ?array |
|
| 41 | + protected function getDimensionsFromStty() : ? array |
|
| 42 | 42 | { |
| 43 | 43 | if (empty($output = $this->execute('stty -a | grep columns'))) { |
| 44 | 44 | return null; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @return array Either an array containing two keys - 'width' and 'height' or null if the data couldn't |
| 61 | 61 | * be parsed to retrieve anything useful. |
| 62 | 62 | */ |
| 63 | - protected function getDimensionsFromTput() : ?array |
|
| 63 | + protected function getDimensionsFromTput() : ? array |
|
| 64 | 64 | { |
| 65 | 65 | if (empty($output = $this->execute('tput cols && tput lines'))) { |
| 66 | 66 | return null; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * {@inheritDoc} |
| 19 | 19 | */ |
| 20 | - protected function getDimensions() : ?array |
|
| 20 | + protected function getDimensions() : ? array |
|
| 21 | 21 | { |
| 22 | 22 | // Ansicon environmental variable is our first fallback. Result of 'mode CON' is the next one. |
| 23 | 23 | if (null === $dimensions = $this->getDimensionsFromAnsicon()) { |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @return array Either an array containing two keys - 'width' and 'height' or null if the data couldn't |
| 39 | 39 | * be parsed to retrieve anything useful. |
| 40 | 40 | */ |
| 41 | - protected function getDimensionsFromAnsicon() : ?array |
|
| 41 | + protected function getDimensionsFromAnsicon() : ? array |
|
| 42 | 42 | { |
| 43 | 43 | if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) { |
| 44 | 44 | return [ |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * @return array Either an array containing two keys - 'width' and 'height' or null if the data couldn't |
| 57 | 57 | * be parsed to retrieve anything useful. |
| 58 | 58 | */ |
| 59 | - protected function getDimensionsFromMode() : ?array |
|
| 59 | + protected function getDimensionsFromMode() : ? array |
|
| 60 | 60 | { |
| 61 | 61 | if (empty($output = $this->execute('mode CON'))) { |
| 62 | 62 | return null; |
@@ -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) { |
@@ -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 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | /** |
| 114 | 114 | * {@inheritDoc} |
| 115 | 115 | */ |
| 116 | - public function getUsername() : ?string |
|
| 116 | + public function getUsername() : ? string |
|
| 117 | 117 | { |
| 118 | 118 | return $this->username; |
| 119 | 119 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | /** |
| 122 | 122 | * {@inheritDoc} |
| 123 | 123 | */ |
| 124 | - public function getName() : ?string |
|
| 124 | + public function getName() : ? string |
|
| 125 | 125 | { |
| 126 | 126 | return $this->name; |
| 127 | 127 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | /** |
| 130 | 130 | * {@inheritDoc} |
| 131 | 131 | */ |
| 132 | - public function getEmail() : ?string |
|
| 132 | + public function getEmail() : ? string |
|
| 133 | 133 | { |
| 134 | 134 | return $this->email; |
| 135 | 135 | } |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | /** |
| 138 | 138 | * {@inheritDoc} |
| 139 | 139 | */ |
| 140 | - public function getAvatar() : ?string |
|
| 140 | + public function getAvatar() : ? string |
|
| 141 | 141 | { |
| 142 | 142 | return $this->avatar; |
| 143 | 143 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function identify(auth\Credentials $credentials) : Promise |
| 96 | 96 | { |
| 97 | - return $this->request('GET', $this->getIdentifyUrl(), $credentials)->then(function (array $data) use ($credentials) { |
|
| 97 | + return $this->request('GET', $this->getIdentifyUrl(), $credentials)->then(function(array $data) use ($credentials) { |
|
| 98 | 98 | return $this->createIdentity($credentials, $data); |
| 99 | 99 | }); |
| 100 | 100 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | { |
| 161 | 161 | return $this->getHttpClient() |
| 162 | 162 | ->requestAsync('POST', $url, array_merge_recursive($this->getDefaultRequestOptions($temporary), $options)) |
| 163 | - ->then(function (Response $response) use($temporary) { |
|
| 163 | + ->then(function(Response $response) use($temporary) { |
|
| 164 | 164 | |
| 165 | 165 | // We are assuming a form-encoded body here - for any Provider that does not return those in this format |
| 166 | 166 | // for handshakes and exchanges this will require refactoring. |
@@ -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 | /** |
@@ -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 | } |
@@ -33,6 +33,6 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | public function getIdentifyUrl() : string |
| 35 | 35 | { |
| 36 | - return static::URL_IDENTIFY . $this->shouldProvideEmailAddress() ? '?include_email=true' : ''; |
|
| 36 | + return static::URL_IDENTIFY.$this->shouldProvideEmailAddress() ? '?include_email=true' : ''; |
|
| 37 | 37 | } |
| 38 | 38 | } |