@@ -88,7 +88,6 @@ |
||
| 88 | 88 | * (decrypt, unserialize etc.) and returns an AccessToken |
| 89 | 89 | * |
| 90 | 90 | * @param mixed $data |
| 91 | - |
|
| 92 | 91 | * @throws \chillerlan\OAuth\Storage\OAuthStorageException |
| 93 | 92 | */ |
| 94 | 93 | public function fromStorage($data):AccessToken; |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | /** |
| 21 | 21 | * Implements a session storage adapter. Session storage is half persistent as tokens are stored for the duration of the session. |
| 22 | 22 | */ |
| 23 | -class SessionStorage extends OAuthStorageAbstract{ |
|
| 23 | +class SessionStorage extends OAuthStorageAbstract { |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * the key name for the token storage array in $_SESSION |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | /** |
| 36 | 36 | * SessionStorage constructor. |
| 37 | 37 | */ |
| 38 | - public function __construct(SettingsContainerInterface $options = null){ |
|
| 38 | + public function __construct(SettingsContainerInterface $options = null) { |
|
| 39 | 39 | parent::__construct($options); |
| 40 | 40 | |
| 41 | 41 | $this->tokenVar = $this->options->sessionTokenVar; |
@@ -43,15 +43,15 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | // Determine if the session has started. |
| 45 | 45 | // @link http://stackoverflow.com/a/18542272/1470961 |
| 46 | - if($this->options->sessionStart && !(session_status() !== PHP_SESSION_NONE)){ |
|
| 46 | + if ($this->options->sessionStart && !(session_status() !== PHP_SESSION_NONE)) { |
|
| 47 | 47 | session_start(); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if(!isset($_SESSION[$this->tokenVar])){ |
|
| 50 | + if (!isset($_SESSION[$this->tokenVar])) { |
|
| 51 | 51 | $_SESSION[$this->tokenVar] = []; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - if(!isset($_SESSION[$this->stateVar])){ |
|
| 54 | + if (!isset($_SESSION[$this->stateVar])) { |
|
| 55 | 55 | $_SESSION[$this->stateVar] = []; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @codeCoverageIgnore |
| 64 | 64 | */ |
| 65 | - public function __destruct(){ |
|
| 66 | - if($this->options->sessionStart){ |
|
| 65 | + public function __destruct() { |
|
| 66 | + if ($this->options->sessionStart) { |
|
| 67 | 67 | session_write_close(); |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function getAccessToken(string $service):AccessToken{ |
| 84 | 84 | |
| 85 | - if($this->hasAccessToken($service)){ |
|
| 85 | + if ($this->hasAccessToken($service)) { |
|
| 86 | 86 | return $this->fromStorage($_SESSION[$this->tokenVar][$service]); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function clearAccessToken(string $service):bool{ |
| 103 | 103 | |
| 104 | - if(array_key_exists($service, $_SESSION[$this->tokenVar])){ |
|
| 104 | + if (array_key_exists($service, $_SESSION[$this->tokenVar])) { |
|
| 105 | 105 | unset($_SESSION[$this->tokenVar][$service]); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function clearAllAccessTokens():bool{ |
| 115 | 115 | |
| 116 | - foreach(array_keys($_SESSION[$this->tokenVar]) as $service){ |
|
| 116 | + foreach (array_keys($_SESSION[$this->tokenVar]) as $service) { |
|
| 117 | 117 | unset($_SESSION[$this->tokenVar][$service]); |
| 118 | 118 | } |
| 119 | 119 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function getCSRFState(string $service):string{ |
| 138 | 138 | |
| 139 | - if($this->hasCSRFState($service)){ |
|
| 139 | + if ($this->hasCSRFState($service)) { |
|
| 140 | 140 | return $_SESSION[$this->stateVar][$service]; |
| 141 | 141 | } |
| 142 | 142 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function clearCSRFState(string $service):bool{ |
| 157 | 157 | |
| 158 | - if(array_key_exists($service, $_SESSION[$this->stateVar])){ |
|
| 158 | + if (array_key_exists($service, $_SESSION[$this->stateVar])) { |
|
| 159 | 159 | unset($_SESSION[$this->stateVar][$service]); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | /** |
| 20 | 20 | * Implements ab anstract OAuth storage adapter |
| 21 | 21 | */ |
| 22 | -abstract class OAuthStorageAbstract implements OAuthStorageInterface{ |
|
| 22 | +abstract class OAuthStorageAbstract implements OAuthStorageInterface { |
|
| 23 | 23 | use LoggerAwareTrait; |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | /** |
| 31 | 31 | * OAuthStorageAbstract constructor. |
| 32 | 32 | */ |
| 33 | - public function __construct(SettingsContainerInterface $options = null, LoggerInterface $logger = null){ |
|
| 33 | + public function __construct(SettingsContainerInterface $options = null, LoggerInterface $logger = null) { |
|
| 34 | 34 | $this->options = $options ?? new OAuthOptions; |
| 35 | 35 | |
| 36 | 36 | $this->setLogger($logger ?? new NullLogger); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function fromStorage($data):AccessToken{ |
| 52 | 52 | |
| 53 | - if(!is_string($data)){ |
|
| 53 | + if (!is_string($data)) { |
|
| 54 | 54 | throw new OAuthStorageException('invalid data'); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -55,7 +55,6 @@ |
||
| 55 | 55 | * @param string|null $method |
| 56 | 56 | * @param array|string|\Psr\Http\Message\StreamInterface|null $body |
| 57 | 57 | * @param array|null $headers |
| 58 | - |
|
| 59 | 58 | * @throws \chillerlan\OAuth\Core\ProviderException |
| 60 | 59 | */ |
| 61 | 60 | public function request( |