<?php


namespace SESSION;


class SESSION {

    public function __construct() {

        $status = true;
        if (php_sapi_name() !== 'cli') {
            if (version_compare(phpversion(), '5.4.0', '>=')) {
                $status = session_status() === PHP_SESSION_ACTIVE ? TRUE : FALSE;
            } else {
                $status = session_id() === '' ? FALSE : TRUE;
            }
        }
        if (!$status)
            session_start();
    }

    public function set($key, $value) {

        $_SESSION[$key] = $value;
        //print_r($_SESSION);die();
    }

    public function uset($key) {
        unset($_SESSION[$key]);
    }

    public function all() {
        return $_SESSION;
    }

    public function get($key) {
        return (isset($_SESSION[$key]) ? $_SESSION[$key] : false);
    }

    public function __destruct() {
        // TODO: I
    }
}