protected function obtainTokenFromSession()
    {
        global $_SESSION;

        if (!isset($_SESSION['formsTokens'])) {
            throw new Exception('no token found', $this::ERR_NO_TOKEN);
        }

        if (!isset($_SESSION['formsTokens'][$this->formId])) {
            throw new Exception(
                'no token found for the form id '.$this->formId,
                $this::ERR_NO_TOKEN_FOR_FORM_ID
            );
        }

        return $_SESSION['formsTokens'][$this->formId];
    }
protected function obtainTokenFromSession()
    {
        global $_SESSION;

        if (!isset($_SESSION['formsTokens'])) {
            throw new Exception('no token found', $this::ERR_NO_TOKEN);
        }

        if (!isset($_SESSION['formsTokens'][$this->formId])) {
            throw new Exception(
                'no token found for the form id '.$this->formId,
                $this::ERR_NO_TOKEN_FOR_FORM_ID
            );
        }

        return $_SESSION['formsTokens'][$this->formId];
    }
protected function obtainTokenFromSession ( ) { global $ _SESSION ; if ( ! isset ( $ _SESSION [ 'formsTokens' ] ) ) { throw new Exception ( 'no token found' , $ this :: ERR_NO_TOKEN ) ; } if ( ! isset ( $ _SESSION [ 'formsTokens' ] [ $ this -> formId ] ) ) { throw new Exception ( 'no token found for the form id ' . $ this -> formId , $ this :: ERR_NO_TOKEN_FOR_FORM_ID ) ; } return $ _SESSION [ 'formsTokens' ] [ $ this -> formId ] ; }
Get a token from the session

@global array $_SESSION

@return object

@throws \Exception If there are no token
Get a token from the session