public function validateRequest($throw = false)
    {
        // Ensure that the actual token is generated and stored
        $this->getTrueToken();

        if (!$this->isValidatedRequest()) {
            return true;
        }

        if (!$this->validateRequestToken()) {
            if ($throw) {
                throw new InvalidCSRFTokenException('Invalid CSRF token');
            }

            $this->killScript();
        }

        return true;
    }
public function validateRequest($throw = false)
    {
        // Ensure that the actual token is generated and stored
        $this->getTrueToken();

        if (!$this->isValidatedRequest()) {
            return true;
        }

        if (!$this->validateRequestToken()) {
            if ($throw) {
                throw new InvalidCSRFTokenException('Invalid CSRF token');
            }

            $this->killScript();
        }

        return true;
    }
public function validateRequest ( $ throw = false ) { // Ensure that the actual token is generated and stored $ this -> getTrueToken ( ) ; if ( ! $ this -> isValidatedRequest ( ) ) { return true ; } if ( ! $ this -> validateRequestToken ( ) ) { if ( $ throw ) { throw new InvalidCSRFTokenException ( 'Invalid CSRF token' ) ; } $ this -> killScript ( ) ; } return true ; }
Validates the csrf token in the HTTP request.

This method should be called in the beginning of the request. By default,
POST, PUT and DELETE requests will be validated for a valid CSRF token.
If the request does not provide a valid CSRF token, this method will
kill the script and send a HTTP 400 (bad request) response to the
browser.

This method also accepts a single parameter than can be either true or
false. If the parameter is set to true, this method will throw an
InvalidCSRFTokenException instead of killing the script if no valid CSRF
token was provided in the request.

This method will always trigger the token storage. If you are using the
cookie storage, this method must be called before the headers have been
sent. If you are using the session storage instead, you must start the
session before calling this method.

@param bool $throw True to throw an exception on invalid token, false to kill the script
@return bool This method always returns true
@throws InvalidCSRFTokenException If throwing is enabled and there is no valid csrf token
@throws Storage\TokenStorageException If the secret token cannot be loaded or stored
Validates the csrf token in the HTTP request .