public static function get($id, $defaultValue = null) { if (static::exists($id)) { $value = $_SESSION[$id]; if (trim($value) !== '') { $value = Guid::decrypt(static::getSecret(), $value); $data = explode('|', $value); if (is_array($data) && trim(end($data)) === static::getSecret()) { return unserialize($data[0]); } } } return $defaultValue; }
public static function getTicket() { if (Cookie::exists(static::COOKIE_NAME) === false) { return null; } $ticket = Guid::decrypt(static::getSalt(), Cookie::get(static::COOKIE_NAME)); if ($ticket !== false) { $ticket = explode('|', $ticket); return count($ticket) > 0 ? $ticket : null; } return null; }