jasny /
sso
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Jasny\SSO\Broker; |
||
| 6 | |||
| 7 | /** |
||
| 8 | * Use global $_SESSION to persist the client token. |
||
| 9 | * |
||
| 10 | * @implements \ArrayAccess<string,mixed> |
||
| 11 | * @codeCoverageIgnore |
||
| 12 | */ |
||
| 13 | class Session implements \ArrayAccess |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @inheritDoc |
||
| 17 | */ |
||
| 18 | public function offsetSet($name, $value): void |
||
| 19 | { |
||
| 20 | $_SESSION[$name] = $value; |
||
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @inheritDoc |
||
| 25 | */ |
||
| 26 | public function offsetUnset($name): void |
||
| 27 | { |
||
| 28 | unset($_SESSION[$name]); |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @inheritDoc |
||
| 33 | */ |
||
| 34 | public function offsetGet($name) |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 35 | { |
||
| 36 | return $_SESSION[$name] ?? null; |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @inheritDoc |
||
| 41 | */ |
||
| 42 | public function offsetExists($name): bool |
||
| 43 | { |
||
| 44 | return isset($_SESSION[$name]); |
||
| 45 | } |
||
| 46 | } |
||
| 47 |