protected function setup($bForceSetup = false)
    {
        if (!empty($this->oSession)) {
            return;
        }

        $oInput = Factory::service('Input');
        //  class_exists check in case the class is called before CI has finished instanciating
        if (!$oInput::isCli() && class_exists('CI_Controller')) {
            /**
             * Look for the session cookie, if it exists, then a session exists
             * and the whole service should be loaded up.
             */
            $oConfig     = Factory::service('Config');
            $sCookieName = $oConfig->item('sess_cookie_name');

            if ($bForceSetup || $oInput::cookie($sCookieName)) {
                //  @todo (Pablo - 2018-03-19) - Remove dependency on CI Sessions
                $oCi = get_instance();
                $oCi->load->library('session');
                if (empty($oCi->session)) {
                    throw new NailsException('Failed to load CodeIgniter session library.');
                }
                $this->oSession = $oCi->session;
            }
        }
    }
protected function setup($bForceSetup = false)
    {
        if (!empty($this->oSession)) {
            return;
        }

        $oInput = Factory::service('Input');
        //  class_exists check in case the class is called before CI has finished instanciating
        if (!$oInput::isCli() && class_exists('CI_Controller')) {
            /**
             * Look for the session cookie, if it exists, then a session exists
             * and the whole service should be loaded up.
             */
            $oConfig     = Factory::service('Config');
            $sCookieName = $oConfig->item('sess_cookie_name');

            if ($bForceSetup || $oInput::cookie($sCookieName)) {
                //  @todo (Pablo - 2018-03-19) - Remove dependency on CI Sessions
                $oCi = get_instance();
                $oCi->load->library('session');
                if (empty($oCi->session)) {
                    throw new NailsException('Failed to load CodeIgniter session library.');
                }
                $this->oSession = $oCi->session;
            }
        }
    }
protected function setup ( $ bForceSetup = false ) { if ( ! empty ( $ this -> oSession ) ) { return ; } $ oInput = Factory :: service ( 'Input' ) ; //  class_exists check in case the class is called before CI has finished instanciating if ( ! $ oInput :: isCli ( ) && class_exists ( 'CI_Controller' ) ) { /**
             * Look for the session cookie, if it exists, then a session exists
             * and the whole service should be loaded up.
             */ $ oConfig = Factory :: service ( 'Config' ) ; $ sCookieName = $ oConfig -> item ( 'sess_cookie_name' ) ; if ( $ bForceSetup || $ oInput :: cookie ( $ sCookieName ) ) { //  @todo (Pablo - 2018-03-19) - Remove dependency on CI Sessions $ oCi = get_instance ( ) ; $ oCi -> load -> library ( 'session' ) ; if ( empty ( $ oCi -> session ) ) { throw new NailsException ( 'Failed to load CodeIgniter session library.' ) ; } $ this -> oSession = $ oCi -> session ; } } }
Attempts to restore or set up a session

@param bool $bForceSetup Whether to force session set up
Attempts to restore or set up a session