Initialize Session. Remove old ephemeral var in Session.

@return self
763514
public function clearEphemeral()
    {
        //~ Check ephemeral vars
        if ($this->has(self::EPHEMERAL)) {
            $ephemeral = $this->get(self::EPHEMERAL);
            foreach ($ephemeral as $name => &$var) {
                if (true === $var[self::ACTIVE]) {
                    $var[self::ACTIVE] = false;
                } else {
                    unset($ephemeral[$name]);
                }
            }
        } else {
            $ephemeral = array();
        }

        //~ Save in Session.
        $this->set(self::EPHEMERAL, $ephemeral);

        return $this;
    }
813335
private function initialize()
    {
        $this->name = (isset($this->configurations['name']))
            ? $this->configurations['name']
            : self::DEFAULT_SESSION_NAME;
        $this->assignSessionLifetime();
        if (isset($this->configurations['encryption_enabled'])
            && $this->configurations['encryption_enabled']) {
            $this->handler = new EncryptedSessionHandler();
        }
        $this->security = new SecuritySession($this->configurations);
    }
770379
public static function initialize()
    {
        $manager = self::$manager = new self();
        $manager->seedHandlerStack();

        session_set_save_handler($manager);

        return $manager;
    }
11244
public function initialize()
    {
        $this->_connection->table(self::TABLE)
            ->createIfNotExists(array(
                'name' => new \Pheasant\Types\StringType(255, 'notnull primary'),
                'id' => new \Pheasant\Types\IntegerType(null, 'notnull unsigned'),
                ));

        return $this;
    }
159858
protected function reset()
    {
        $this->scriptName      = null;
        $this->commandName     = null;
        $this->options         = [];
        $this->arguments       = [];

        return $this;
    }
342927
protected function initialize()
    {
        $this->configuration = new ValueHolder($this->loadConfiguration());
        $this->defaults = new ValueHolder($this->getDefaults());

        return $this;
    }
866430
public function reset()
    {
        $this->hashHandler = null;
        $this->bodyCanonIgnoreStart = 2;
        $this->bodyCanonEmptyCounter = 0;
        $this->bodyCanonLastChar = null;
        $this->bodyCanonSpace = false;

        return $this;
    }
566715
public function reset()
    {
        $reflection = new \ReflectionClass(static::class);
        foreach ($reflection->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
            if (!$property->isStatic()) {
                $this->{$property->getName()} = null;
            }
        }
        return $this;
    }
581719
public function afterSessionStart()
	{
		$session = JFactory::getSession();

		if ($session->isNew())
		{
			$session->set('registry', new Registry('session'));
			$session->set('user', new JUser);
		}
	}
1238939
public function initializeState()
	{
		if (Session::has($this->session_key))
		{
			$this->setStateArray( Session::get($this->session_key) );
		}
		else
		{
			$this->resetState();
		}
		return $this->getStateArray();
	}
124349
public function regenerate()
    {
        // we will regenerate session ID
        session_regenerate_id(true);

        session_write_close();

        if (isset($_SESSION)) {
            $data = $_SESSION;
            session_start();
            $_SESSION = $data;
        } else {
            session_start();
        }

        // we will store session global variable reference into storage property
        $this->storage = &$_SESSION;

        return $this;
    }
1121174
public static function init() {

        if (self::$_sessionStarted == false) {

            self::start();
            self::$_sessionStarted = true;
        }

        // Thanks Jon - http://stackoverflow.com/questions/8311320/how-to-change-the-session-timeout-in-php
        $now = time();
        if (isset($_SESSION['expiration_time']) && $now > $_SESSION['expiration_time']) {

            self::destroy();
            self::start();
        }

        $timeout = 3600;
        if (!empty(Config::get('session', 'timeout'))) {

            $timeout = Config::get('session', 'timeout');
        }

        $_SESSION['expiration_time'] = $now + $timeout;
    }
1056621
public static function _init()
	{
		\Config::load('session', true);

		if (\Config::get('session.auto_initialize', true))
		{
			static::instance();
		}

		if (\Config::get('session.native_emulation', false))
		{
			// emulate native PHP sessions
			session_set_save_handler (
				// open
				function ($savePath, $sessionName) {
				},
				// close
				function () {
				},
				// read
				function ($sessionId) {
					// copy all existing session vars into the PHP session store
					$_SESSION = \Session::get();
					$_SESSION['__org'] = $_SESSION;
				},
				// write
				function ($sessionId, $data) {
					// get the original data
					$org = isset($_SESSION['__org']) ? $_SESSION['__org'] : array();
					unset($_SESSION['__org']);

					// do we need to remove stuff?
					if ($remove = array_diff_key($org, $_SESSION))
					{
						\Session::delete(array_keys($remove));
					}

					// add or update the remainder
					empty($_SESSION) or \Session::set($_SESSION);
				},
				// destroy
				function ($sessionId) {
					\Session::destroy();
				},
				// gc
				function ($lifetime) {
				}
			);
		}
	}
1142414
public function resetSession()
    {
        /*
         * TODO not in love with suppressing errors
         */
        if (session_status() !== PHP_SESSION_ACTIVE) {
            @session_start();
        }
        @session_destroy();
        @session_unset();
        @session_start();
        session_regenerate_id(true);
        $_SESSION[__CLASS__] =& $this;
        session_write_close();
    }
779637
private function __init()
    {
        $this->_session = Session::start($this->_timeout, $this->_path, $this->_domain, $this->_httpOnly, $this->_secure);

        if (!$this->_session) {
            return false;
        }

        if (!isset($_SESSION[$this->_index])) {
            $_SESSION[$this->_index] = array();
        }

        // Class FrontendPage uses $_COOKIE directly (inside it's __buildPage() function), so try to emulate it.
        // @deprecated will be removed in Symphony 3.0.0
        $_COOKIE[$this->_index] = &$_SESSION[$this->_index];

        return $this->_session;
    }
398212
public function cleanup(): self
    {
        foreach ($this->original as $key => $value) {
            ini_set($key, $value);
        }

        $this->original = [];

        return $this;
    }
654283
public function sessionInit()
    {
        ini_set('session.auto_start', 0);
        $config = Container::get('config')->get('session');
        if ($config['adapter'] != '') {
            $class = '\\Kotori\\Http\\Session\\' . ucfirst($config['adapter']);
            if (!class_exists($class) || !session_set_save_handler(new $class($config))) {
                throw new NotFoundException('error session handler:' . $class);
            }
        }

        session_name('KOTORI_SESSID');
        if (isset($config['auto_start']) && $config['auto_start']) {
            session_start();
            $this->hasSessionStarted = true;
        }
    }