| Total Complexity | 6 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class InstagramSessionPersistentDataHandler implements PersistentDataInterface |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var string Prefix to use for session variables. |
||
| 16 | */ |
||
| 17 | protected $sessionPrefix = 'FBRLH_'; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Init the session handler. |
||
| 21 | * |
||
| 22 | * @param boolean $enableSessionCheck |
||
| 23 | * |
||
| 24 | * @throws InstagramSDKException |
||
| 25 | */ |
||
| 26 | public function __construct($enableSessionCheck = true) |
||
| 27 | { |
||
| 28 | if ($enableSessionCheck && session_status() !== PHP_SESSION_ACTIVE) { |
||
| 29 | throw new InstagramSDKException( |
||
| 30 | 'Sessions are not active. Please make sure session_start() is at the top of your script.', |
||
| 31 | 720 |
||
| 32 | ); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @inheritdoc |
||
| 38 | */ |
||
| 39 | public function get($key) |
||
| 40 | { |
||
| 41 | if (isset($_SESSION[$this->sessionPrefix . $key])) { |
||
| 42 | return $_SESSION[$this->sessionPrefix . $key]; |
||
| 43 | } |
||
| 44 | |||
| 45 | return null; |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @inheritdoc |
||
| 50 | */ |
||
| 51 | public function set($key, $value) |
||
| 54 | } |
||
| 55 | } |
||
| 56 |