public function init()
    {
        $oInput         = Factory::service('Input');
        $iTestingAsUser = $oInput->header(Testing::TEST_HEADER_USER_NAME);

        if (Environment::not(Environment::ENV_PROD) && $iTestingAsUser) {

            $oUser = $this->getById($iTestingAsUser);
            if (empty($oUser)) {
                set_status_header(500);
                ErrorHandler::halt('Not a valid user ID');
            }
            $this->setLoginData($oUser->id);

        } else {

            //  Refresh user's session
            $this->refreshSession();

            //  If no user is logged in, see if there's a remembered user to be logged in
            if (!$this->isLoggedIn()) {
                $this->loginRememberedUser();
            }
        }
    }
public function init()
    {
        $oInput         = Factory::service('Input');
        $iTestingAsUser = $oInput->header(Testing::TEST_HEADER_USER_NAME);

        if (Environment::not(Environment::ENV_PROD) && $iTestingAsUser) {

            $oUser = $this->getById($iTestingAsUser);
            if (empty($oUser)) {
                set_status_header(500);
                ErrorHandler::halt('Not a valid user ID');
            }
            $this->setLoginData($oUser->id);

        } else {

            //  Refresh user's session
            $this->refreshSession();

            //  If no user is logged in, see if there's a remembered user to be logged in
            if (!$this->isLoggedIn()) {
                $this->loginRememberedUser();
            }
        }
    }
public function init ( ) { $ oInput = Factory :: service ( 'Input' ) ; $ iTestingAsUser = $ oInput -> header ( Testing :: TEST_HEADER_USER_NAME ) ; if ( Environment :: not ( Environment :: ENV_PROD ) && $ iTestingAsUser ) { $ oUser = $ this -> getById ( $ iTestingAsUser ) ; if ( empty ( $ oUser ) ) { set_status_header ( 500 ) ; ErrorHandler :: halt ( 'Not a valid user ID' ) ; } $ this -> setLoginData ( $ oUser -> id ) ; } else { //  Refresh user's session $ this -> refreshSession ( ) ; //  If no user is logged in, see if there's a remembered user to be logged in if ( ! $ this -> isLoggedIn ( ) ) { $ this -> loginRememberedUser ( ) ; } } }
Initialise the generic user model

@return void
Initialise the generic user model