sessionKey = $sessionKey; } /** * @param string * @param mixed * @return self */ public function set($name, $value) { if ($value === NULL) { return $this->remove($name); } $this->check(__METHOD__); $_SESSION[$this->sessionKey][$name] = $value; return $this; } /** * @param string * @return mixed */ public function get($name) { $this->check(__METHOD__); return isset($_SESSION[$this->sessionKey][$name]) ? $_SESSION[$this->sessionKey][$name] : NULL; } /** * @param string * @return self */ public function remove($name) { $this->check(__METHOD__); unset($_SESSION[$this->sessionKey][$name]); return $this; } /** * @param string */ private function check($method) { if (!isset($_SESSION)) { trigger_error("Start session before using $method().", E_USER_WARNING); } } }