for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace XoopsModules\Wggithub\Github\Storages;
use XoopsModules\Wggithub\Github;
/**
* Session storage which uses $_SESSION directly. Session must be started already before use.
*
* @author Miloslav Hůla (https://github.com/milo)
*/
class SessionStorage extends Github\Sanity implements ISessionStorage
{
const SESSION_KEY = 'milo.github-api';
/** @var string */
private $sessionKey;
* @param string
public function __construct($sessionKey = self::SESSION_KEY)
$this->sessionKey = $sessionKey;
}
* @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;
* @return mixed
public function get($name)
return isset($_SESSION[$this->sessionKey][$name])
? $_SESSION[$this->sessionKey][$name]
: NULL;
public function remove($name)
unset($_SESSION[$this->sessionKey][$name]);
private function check($method)
if (!isset($_SESSION)) {
\trigger_error("Start session before using $method().", E_USER_WARNING);