Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit edb4fb8

Browse files
committed
:octocat: SessionStorage: remove unnecessary checks while storing
1 parent d7c2eec commit edb4fb8

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

src/Storage/SessionStorage.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,7 @@ public function __destruct(){
7373
* @inheritDoc
7474
*/
7575
public function storeAccessToken(string $service, AccessToken $token):OAuthStorageInterface{
76-
$data = $this->toStorage($token);
77-
78-
if(isset($_SESSION[$this->sessionVar]) && is_array($_SESSION[$this->sessionVar])){
79-
$_SESSION[$this->sessionVar][$service] = $data;
80-
}
81-
else{
82-
$_SESSION[$this->sessionVar] = [$service => $data];
83-
}
76+
$_SESSION[$this->sessionVar][$service] = $this->toStorage($token);
8477

8578
return $this;
8679
}
@@ -134,13 +127,7 @@ public function clearAllAccessTokens():OAuthStorageInterface{
134127
* @inheritDoc
135128
*/
136129
public function storeCSRFState(string $service, string $state):OAuthStorageInterface{
137-
138-
if(isset($_SESSION[$this->stateVar]) && is_array($_SESSION[$this->stateVar])){
139-
$_SESSION[$this->stateVar][$service] = $state;
140-
}
141-
else{
142-
$_SESSION[$this->stateVar] = [$service => $state];
143-
}
130+
$_SESSION[$this->stateVar][$service] = $state;
144131

145132
return $this;
146133
}

0 commit comments

Comments
 (0)