public function trap(CNabuHTTPRequest $nb_request, CNabuHTTPResponse $nb_response) : bool
    {
        if (($this->nb_request = $nb_request) === null ||
            ($this->nb_response = $nb_response) === null ||
            ($this->nb_engine = CNabuEngine::getEngine()) === null ||
            ($this->nb_application = $this->nb_engine->getApplication()) === null ||
            ($this->nb_session = CNabuHTTPSession::getSession()) === null ||
            ($this->nb_server = $this->nb_engine->getHTTPServer()->getServer()) === null ||
            ($this->nb_customer = $this->nb_engine->getCustomer()) === null ||
            ($this->nb_site = $this->nb_request->getSite()) === null ||
            ($this->nb_site_alias = $this->nb_request->getSiteAlias()) === null ||
            ($this->nb_site_target = $this->nb_request->getSiteTarget()) === null ||
            ($this->nb_language = $this->nb_request->getLanguage()) === null
        ) {
            $retval = false;
        } else {
            $this->nb_work_customer = $this->nb_application->getSecurityManager()->getWorkCustomer();
            $this->nb_user = $this->nb_application->getSecurityManager()->getUser();
            $this->nb_role = $this->nb_application->getSecurityManager()->getRole();
            $this->nb_site_role = $this->nb_application->getSecurityManager()->getSiteRole();
            $this->nb_site_user = $this->nb_application->getSecurityManager()->getSiteUser();
            $this->nb_site_alias_role = $this->nb_request->getSiteAliasRole();
            $this->nb_commerce = $this->nb_request->getCommerce();
            //$this->nb_apps_morphs = $this->nb_engine->getAppsMorphs();
            $retval = true;
        }

        return $retval;
    }
public function trap(CNabuHTTPRequest $nb_request, CNabuHTTPResponse $nb_response) : bool
    {
        if (($this->nb_request = $nb_request) === null ||
            ($this->nb_response = $nb_response) === null ||
            ($this->nb_engine = CNabuEngine::getEngine()) === null ||
            ($this->nb_application = $this->nb_engine->getApplication()) === null ||
            ($this->nb_session = CNabuHTTPSession::getSession()) === null ||
            ($this->nb_server = $this->nb_engine->getHTTPServer()->getServer()) === null ||
            ($this->nb_customer = $this->nb_engine->getCustomer()) === null ||
            ($this->nb_site = $this->nb_request->getSite()) === null ||
            ($this->nb_site_alias = $this->nb_request->getSiteAlias()) === null ||
            ($this->nb_site_target = $this->nb_request->getSiteTarget()) === null ||
            ($this->nb_language = $this->nb_request->getLanguage()) === null
        ) {
            $retval = false;
        } else {
            $this->nb_work_customer = $this->nb_application->getSecurityManager()->getWorkCustomer();
            $this->nb_user = $this->nb_application->getSecurityManager()->getUser();
            $this->nb_role = $this->nb_application->getSecurityManager()->getRole();
            $this->nb_site_role = $this->nb_application->getSecurityManager()->getSiteRole();
            $this->nb_site_user = $this->nb_application->getSecurityManager()->getSiteUser();
            $this->nb_site_alias_role = $this->nb_request->getSiteAliasRole();
            $this->nb_commerce = $this->nb_request->getCommerce();
            //$this->nb_apps_morphs = $this->nb_engine->getAppsMorphs();
            $retval = true;
        }

        return $retval;
    }
public function trap ( CNabuHTTPRequest $ nb_request , CNabuHTTPResponse $ nb_response ) : bool { if ( ( $ this -> nb_request = $ nb_request ) === null || ( $ this -> nb_response = $ nb_response ) === null || ( $ this -> nb_engine = CNabuEngine :: getEngine ( ) ) === null || ( $ this -> nb_application = $ this -> nb_engine -> getApplication ( ) ) === null || ( $ this -> nb_session = CNabuHTTPSession :: getSession ( ) ) === null || ( $ this -> nb_server = $ this -> nb_engine -> getHTTPServer ( ) -> getServer ( ) ) === null || ( $ this -> nb_customer = $ this -> nb_engine -> getCustomer ( ) ) === null || ( $ this -> nb_site = $ this -> nb_request -> getSite ( ) ) === null || ( $ this -> nb_site_alias = $ this -> nb_request -> getSiteAlias ( ) ) === null || ( $ this -> nb_site_target = $ this -> nb_request -> getSiteTarget ( ) ) === null || ( $ this -> nb_language = $ this -> nb_request -> getLanguage ( ) ) === null ) { $ retval = false ; } else { $ this -> nb_work_customer = $ this -> nb_application -> getSecurityManager ( ) -> getWorkCustomer ( ) ; $ this -> nb_user = $ this -> nb_application -> getSecurityManager ( ) -> getUser ( ) ; $ this -> nb_role = $ this -> nb_application -> getSecurityManager ( ) -> getRole ( ) ; $ this -> nb_site_role = $ this -> nb_application -> getSecurityManager ( ) -> getSiteRole ( ) ; $ this -> nb_site_user = $ this -> nb_application -> getSecurityManager ( ) -> getSiteUser ( ) ; $ this -> nb_site_alias_role = $ this -> nb_request -> getSiteAliasRole ( ) ; $ this -> nb_commerce = $ this -> nb_request -> getCommerce ( ) ; //$this->nb_apps_morphs = $this->nb_engine->getAppsMorphs(); $ retval = true ; } return $ retval ; }
This method is called just after the instantiation of plugin to set request and response objects.
After called from the Engine, all protected properties of this class are setted with proper values.
@param CNabuHTTPRequest $nb_request Request instance.
@param CNabuHTTPResponse $nb_response Response instance.
@return bool Return true if trap successfully or false if not.
This method is called just after the instantiation of plugin to set request and response objects . After called from the Engine all protected properties of this class are setted with proper values .