4 changed files with 33 additions and 9 deletions
@ -0,0 +1,25 @@ |
|||
<?php |
|||
|
|||
namespace App\Wrappers; |
|||
|
|||
use App\Enumerators\SessionElement; |
|||
|
|||
class SessionWrapper |
|||
{ |
|||
public static function Start(): void |
|||
{ |
|||
if (session_status() == PHP_SESSION_NONE) { |
|||
session_start(); |
|||
} |
|||
} |
|||
|
|||
public static function Get(SessionElement $target) |
|||
{ |
|||
self::Start(); |
|||
if(array_key_exists(key: $target->value, array: $_SESSION)) |
|||
{ |
|||
return $_SESSION[$target->value]; |
|||
} |
|||
die(); |
|||
} |
|||
} |
Loading…
Reference in new issue