public function session($key = '', $value = '')
    {
        $this->sessionStart();

        if (is_null($key)) {
            if (empty($_SESSION)) {
                return null;
            }

            unset($_SESSION);
        } elseif ('' === $key) {
            // Get All Session
            return $_SESSION;
        }

        if ('' === $value) {
            return isset($_SESSION[$key]) ? $_SESSION[$key] : null;
        } else {
            if (is_null($value)) {
                unset($_SESSION[$key]);
            } else {
                $_SESSION[$key] = $value;
            }
        }

        return null;
    }
public function session($key = '', $value = '')
    {
        $this->sessionStart();

        if (is_null($key)) {
            if (empty($_SESSION)) {
                return null;
            }

            unset($_SESSION);
        } elseif ('' === $key) {
            // Get All Session
            return $_SESSION;
        }

        if ('' === $value) {
            return isset($_SESSION[$key]) ? $_SESSION[$key] : null;
        } else {
            if (is_null($value)) {
                unset($_SESSION[$key]);
            } else {
                $_SESSION[$key] = $value;
            }
        }

        return null;
    }
public function session ( $ key = '' , $ value = '' ) { $ this -> sessionStart ( ) ; if ( is_null ( $ key ) ) { if ( empty ( $ _SESSION ) ) { return null ; } unset ( $ _SESSION ) ; } elseif ( '' === $ key ) { // Get All Session return $ _SESSION ; } if ( '' === $ value ) { return isset ( $ _SESSION [ $ key ] ) ? $ _SESSION [ $ key ] : null ; } else { if ( is_null ( $ value ) ) { unset ( $ _SESSION [ $ key ] ) ; } else { $ _SESSION [ $ key ] = $ value ; } } return null ; }
Set or Get session

@param  mixed  $key
@param  string $value
@return mixed
Set or Get session