Start a new session

@param string $name Name of session
@param string $id Session id
@param \SessionHandlerInterface Session handler

@return bool
186664
public function start($name = null, $id = null, \SessionHandlerInterface $handler = null) {
        if (!$this->getId()) {
            if ($name !== null) {
                $this->setName($name);
            }

            if ($id !== null) {
                $this->setId($id);
            }

            if ($handler !== null) {
                $this->setHandler($handler);
            }

            return $this->startSession();
        }
    }
284889
public function addAuthMethod($name, MethodInterface $method)
    {
        $this->getAuthentication()->addMethod($name, $method);

        return $this;
    }
831997
public function sendBlock($id, $data, $name = null)
    {
        $this->send("id: {$id}\n");
        if (strlen($name) && $name !== null) {
            $this->send("event: {$name}\n");
        }
        $this->send($this->wrapData($data)."\n\n");
    }
484185
public function start($id = self::DEFAULT_ID)
    {
        $microtime = false;
        if (self::$enabled) {
            $id = (!$id) ? self::DEFAULT_ID : (string)$id;
            if (isset($this->start[$id])) {
                $this->toss(
                    "Profiling",
                    "Profiling has already started for identifier '{0}'.",
                    $id
                );
            }
            
            $this->start[$id] = $microtime = microtime(true);
        }
        
        return $microtime;
    }
705766
private function startSession() {

        if (session_id() == "" || session_id() == null) {
            if (isset ($_REQUEST ["HTTPSESSID"])) {
                session_id($_REQUEST ["HTTPSESSID"]);
            }
            else if (isset ($_REQUEST ["PHPSESSID"])) {
                session_id($_REQUEST ["PHPSESSID"]);
            }
        }

        $cookieDomain = Configuration::instance()->getParameter('session.cookie.domain');
        if ($cookieDomain) {

            if ($cookieDomain == "WILDCARD") {
                $host = isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : "";
                if ($host) {
                    $splitHost = explode(".", $host);
                    $tld = array_pop($splitHost);
                    $domain = array_pop($splitHost);
                    $cookieDomain = ".$domain.$tld";
                } else {
                    return;
                }
            }



            ini_set("session.cookie_domain", $cookieDomain);
        }

        @session_start();

    }
716599
public function start(): bool
    {
        if (!is_null($this->expiration)) {
            $this->expiration->start();
        }
        if (!is_null($this->fingerprint)) {
            $this->fingerprint->start();
        }
        if (!isset($_SESSION['__HANDLER_INITIATED'])) {
            return $this->initialSessionStart();
        } else {
            return $this->laterSessionStart();
        }
    }
665020
protected function registerClientOptions($name, $id)
    {
        if ($this->clientOptions !== false) {
            $options = empty($this->clientOptions) ? '' : Json::htmlEncode($this->clientOptions);
            $js = "jQuery('#$id').$name($options);";
            $this->getView()->registerJs($js);
        }
    }
811283
public function pushHandler($name, HandlerInterface $handler): LoggerInterface
    {
        $this->handlers->set($name, $handler);
        
        return $this;
    }
1270116
public function sendBlock($id, $data, $name = null)
    {
        $this->output("id: {$id}\n");
        if (strlen($name) && $name !== null) {
            $this->output("event: {$name}\n");
        }
        $this->output($this->wrapData($data)."\n\n");
        flush();
    }
450849
public static function get_handler_from_id($id) {
        global $DB;

        $record = $DB->get_record('messageinbound_handlers', array('id' => $id), '*', IGNORE_MISSING);
        if (!$record) {
            return false;
        }
        return self::handler_from_record($record);
    }
170600
public function create($name)
    {
        $config = $this->getConfiguration($name);

        if(null === $config) {
            throw new \RuntimeException(
                "Connection with name: $name not found."
            );
        }

        return new Client($config);
    }
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;
        }
    }
887041
public function startSession($user_id)
    {
        $this->deleteOldSessions();

        $user_id = (int)$user_id;
        $sid = $this->generateUserSid($user_id);

        $session = UsersSessionEntityRepository::findOneEntityByCriteria([
            'sid'     => $sid,
            'user_id' => $user_id,
        ]);
        if (!$session) {
            $session = new UsersSessionEntity();
        }
        $session->setSid($sid);
        $session->setUserId($user_id);
        $session->save();

        return $sid;
    }
1340771
public function add_handler( HandlerInterface $handler, $name = NULL ) {

		( $name === null ) and $name = spl_object_hash( $handler );
		if ( ! is_string( $name ) || array_key_exists( $name, $this->handlers ) ) {
			return $this;
		}

		$this->handlers[ $name ] = $handler;

		return $this;
	}
683115
public function start()
    {
        if ($this->isSessionStarted()) {
            return;
        }

        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        if ($this->isAdmin()) {
            $this->setName("admin_sid");
        } else {
            $this->setName("sid");
        }

        $sid = $this->getSidFromRequest();

        //starting session if only we can
        if ($this->_allowSessionStart()) {
            //creating new sid
            if (!$sid) {
                self::$_blIsNewSession = true;
                $this->initNewSession();
            } else {
                self::$_blIsNewSession = false;
                $this->_setSessionId($sid);
                $this->_sessionStart();
            }

            //special handling for new ZP cluster session, as in that case session_start() regenerates id
            if ($this->_sId != session_id()) {
                $this->_setSessionId(session_id());
            }

            //checking for swapped client
            $blSwapped = $this->_isSwappedClient();
            if (!self::$_blIsNewSession && $blSwapped) {
                $this->initNewSession();

                // passing notification about session problems
                if ($this->_sErrorMsg && $myConfig->getConfigParam('iDebug')) {
                    \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay(oxNew(\OxidEsales\Eshop\Core\Exception\StandardException::class, $this->_sErrorMsg));
                }
            } elseif (!$blSwapped) {
                // transferring cookies between hosts
                \OxidEsales\Eshop\Core\Registry::getUtilsServer()->loadSessionCookies();
            }
        }
    }
1341026
public function addHandler($name, $handler)
    {
        $tmp        = $this->relationHandlers->getValue($this->entity);
        $tmp[$name] = $handler;
        $this->relationHandlers->setValue($this->entity, $tmp);
    }
285953
public function start()
    {
        if (!$this->isActive())
        {
            //Make sure we have a registered session handler
            if (!$this->getHandler()->isRegistered()) {
                $this->getHandler()->register();
            }

            session_cache_limiter('none');

            if (ini_get('session.use_cookies') && headers_sent()) {
                throw new RuntimeException('Failed to start the session because headers have already been sent');
            }

            if (!session_start()) {
                throw new RuntimeException('Session could not be started');
            }

            //Re-load the session containers
            $this->refesh();

            // Destroy an expired session
            if ($this->getContainer('metadata')->isExpired()) {
                $this->destroy();
            }
        }

        return $this;
    }