initialize and saves session
@return $this
485095
private function _login($id){
    if ( $this->check() && $id ){
      $this
        ->_authenticate($id)
        ->_user_info()
        ->_init_dir(true)
        ->save_session();
    }
    return $this;
  }
219749
protected function init()
    {
        $config = self::getConfig();

        // validate that headers have not already been sent
        if (headers_sent()) {
            throw new SessionException('Unable to register session handler because headers have already been sent.');
        }

        // remove any shut down functions
        session_register_shutdown();

        // get the driver
        $saveHandler = $config->get('Storage.Driver', NativeStorage::class);

        try {
            // try to create driver instance
            $saveHandler = new $saveHandler($config);

            // register driver as session handler
            session_set_save_handler($saveHandler, false);

            // start the session
            if (session_status() == PHP_SESSION_NONE) {
                session_start();
            }

            // get session id
            $this->sessionId = session_id();

            // save current session locally
            $this->sessionBag = $this->arr($_SESSION);
        } catch (\Exception $e) {
            throw new SessionException($e->getMessage());
        }
    }
771738
private function sessionStart()
    {
        if (session_status() !== PHP_SESSION_ACTIVE) {
            $request = new Request;
            session_set_cookie_params(
                0,
                $request->getBasePath(),
                null,
                $request->getUri()->getScheme() === 'https',
                true
            );
            session_start();
        }
    }
581719
public function afterSessionStart()
	{
		$session = JFactory::getSession();

		if ($session->isNew())
		{
			$session->set('registry', new Registry('session'));
			$session->set('user', new JUser);
		}
	}
65072
public function save()
    {
        if (null !== $this->cache) {
            $this->loadConfig(null);
            $this->cache->save($this->pool);
        }
        return $this;
    }
152761
public function initSession()
    {
        $sessionManager = new SessionManager();
        $sessionManager->start();
        Container::setDefaultManager($sessionManager);
        $container = new Container('melisinstaller');

    }
980911
public function init()
    {
        $request =& $this->request;
        $route = '/:controller/:action';
        $opts = array('controller' => 'Home', 'action' => 'index');

        // Inlined as a closure to fix "using $this when not in object context" on 5.3
        $validateSession = function () {
            if (!empty($_SESSION['phpci_user_id'])) {
                $user = b8\Store\Factory::getStore('User')->getByPrimaryKey($_SESSION['phpci_user_id']);

                if ($user) {
                    $_SESSION['phpci_user'] = $user;
                    return true;
                }

                unset($_SESSION['phpci_user_id']);
            }

            return false;
        };

        $skipAuth = array($this, 'shouldSkipAuth');

        // Handler for the route we're about to register, checks for a valid session where necessary:
        $routeHandler = function (&$route, Response &$response) use (&$request, $validateSession, $skipAuth) {
            $skipValidation = in_array($route['controller'], array('session', 'webhook', 'build-status'));

            if (!$skipValidation && !$validateSession() && (!is_callable($skipAuth) || !$skipAuth())) {
                if ($request->isAjax()) {
                    $response->setResponseCode(401);
                    $response->setContent('');
                } else {
                    $_SESSION['phpci_login_redirect'] = substr($request->getPath(), 1);
                    $response = new RedirectResponse($response);
                    $response->setHeader('Location', PHPCI_URL.'session/login');
                }

                return false;
            }

            return true;
        };

        $this->router->clearRoutes();
        $this->router->register($route, $opts, $routeHandler);
    }
926472
public static function init()
	{
		if(!self::$isInited)
		{
			self::name(Config::get('@.SESSION_NAME', null));
			self::savePath(Config::get('@.SESSION_SAVEPATH', null));
			self::useCookies(Config::get('@.SESSION_USE_COOKIES', null));
			self::cacheExpire(Config::get('@.SESSION_CACHE_EXPIRE', null));
			self::cacheLimiter(Config::get('@.SESSION_CACHE_LIMITER', null));
			self::gcProbability(Config::get('@.SESSION_GC_PROBABILITY', null));
			self::maxLifetime(Config::get('@.SESSION_MAX_LIFETIME', null));
			self::prefix(Config::get('@.SESSION_PREFIX', ''));
			self::cookieDomain(Config::get('@.SESSION_COOKIE_DOMAIN',null));
			$saveHandler = Config::get('@.SESSION_SAVE_HANDLER', 'files');
			self::saveHandler($saveHandler);
			if('user' === $saveHandler)
			{
				self::userSaveHandler(Config::get('@.SESSION_USER_SAVE_HANDLER'));
			}
			self::$isInited = true;
			if(null !== self::$sessionID)
			{
				session_id(self::$sessionID);
			}
			session_start();
			session_write_close();
			return true;
		}
		else
		{
			return false;
		}
	}
1363276
protected function sessionInit()
    {
        if ( !isset( $this->settings['session'] ) || !$this->settings['session']['configured'] )
        {
            // running without Symfony2 or session is not configured
            // we keep the historic behaviour
            $ini = eZINI::instance();
            if ( $ini->variable( 'Session', 'ForceStart' ) === 'enabled' )
                eZSession::start();
            else
                eZSession::lazyStart();
        }
        else
        {
            $sfHandler = new ezpSessionHandlerSymfony(
                $this->settings['session']['has_previous']
                    || $this->settings['session']['started']
            );
            $sfHandler->setStorage( $this->settings['session']['storage'] );
            eZSession::init(
                $this->settings['session']['name'],
                $this->settings['session']['started'],
                $this->settings['session']['namespace'],
                $sfHandler
            );
        }

        // let session specify if db is required
        $this->siteBasics['db-required'] = eZSession::getHandlerInstance()->dbRequired();
    }
310608
private static function init(): void
    {
        if (!static::$initialized) {
            $baseClass = Base::getInstance();
            static::$initialized = true;
            static::$backend = (string)$baseClass->Session->Backend;
            static::$savePath = $baseClass->parsePath($baseClass->Session->SavePath);
            static::$savePath = \trim(\session_save_path()) != '' ? \session_save_path() : static::$savePath;

            Directory::create(static::$savePath);
        }
    }
481676
protected function initialize()
    {
        if ($this->initialized) {
            // Already initialized
            return true;
        }

        if (session_status() !== PHP_SESSION_NONE) {

            if (isset($_SESSION[$this->key]) && is_array($_SESSION[$this->key])) {
                // Get the token collection from the session, if we got any
                $this->tokens = $_SESSION[$this->key];
            }

            $this->initialized = true;

        } else {

            throw new CsrfSessionException('A session must be started before the Csrf library can be used');

        }
    }
498437
public function initialize()
    {
        try {
            $this->logger->debug('Connecting to the websocket');
            $this->engine->connect();
            $this->logger->debug('Connected to the server');

            $this->isConnected = true;
        } catch (SocketException $e) {
            $this->logger->error('Could not connect to the server', ['exception' => $e]);

            throw $e;
        }

        return $this;
    }
931529
public function startSession()
  {
    if ($this->sessionState == self::SESSION_NOT_STARTED && !headers_sent()) {
      $this->sessionState = session_start();
    }
    return $this->sessionState;
  }
209805
public function initialize()
    {
        $this->hasOne('id', 'Baka\Auth\Models\Sessions', 'users_id', ['alias' => 'session']);
        $this->hasMany('id', 'Baka\Auth\Models\Sessions', 'users_id', ['alias' => 'sessions']);
        $this->hasMany('id', 'Baka\Auth\Models\SessionKeys', 'users_id', ['alias' => 'sessionKeys']);
        $this->hasMany('id', 'Baka\Auth\Models\Banlist', 'users_id', ['alias' => 'bans']);
        $this->hasMany('id', 'Baka\Auth\Models\Sessions', 'users_id', ['alias' => 'sessions']);
        $this->hasMany('id', 'Baka\Auth\Models\UserConfig', 'users_id', ['alias' => 'config']);
        $this->hasMany('id', 'Baka\Auth\Models\UserLinkedSources', 'users_id', ['alias' => 'sources']);
        $this->hasMany('id', 'Baka\Auth\Models\UsersAssociatedCompany', 'users_id', ['alias' => 'companies']);
        $this->hasOne('default_company', 'Baka\Auth\Models\Companies', 'id', ['alias' => 'defaultCompany']);
    }
1025040
private function init_session()
	{
		session_set_cookie_params(ini_get('session.cookie_lifetime'), $this->path);
		session_name('sid');
		session_start();
		$this->session = &$_SESSION['session'];
		if (!isset($this->session['msg']))
		{
			$this->session['msg'] = array('error' => array(), 'information' => array());
		}
		$this->user = &$_SESSION['user'];

		# Обратная совместимость
		$GLOBALS['session'] = &$_SESSION['session'];
		$GLOBALS['user'] = &$_SESSION['user'];
	}
342927
protected function initialize()
    {
        $this->configuration = new ValueHolder($this->loadConfiguration());
        $this->defaults = new ValueHolder($this->getDefaults());

        return $this;
    }
1297970
public function init()
    {
        parent::init();
        $this->sessionKey = $this->getSessionKey();
        $this->cache = Instance::ensure($this->cache, Cache::class);
    }