original_string: protected function _validateAndUnsetTokenField(ServerRequest $request)
      {
          if (in_array($request->getMethod(), ['PUT', 'POST', 'DELETE', 'PATCH']) || $request->getData()) {
              $this->_validateToken($request);
              $body = $request->getParsedBody();
              if (is_array($body)) {
                  unset($body[$this->_config['field']]);
                  $request = $request->withParsedBody($body);
              }
          }
  
          return $request;
      }
code: protected function _validateAndUnsetTokenField(ServerRequest $request)
      {
          if (in_array($request->getMethod(), ['PUT', 'POST', 'DELETE', 'PATCH']) || $request->getData()) {
              $this->_validateToken($request);
              $body = $request->getParsedBody();
              if (is_array($body)) {
                  unset($body[$this->_config['field']]);
                  $request = $request->withParsedBody($body);
              }
          }
  
          return $request;
      }
code_tokens: protected function _validateAndUnsetTokenField ( ServerRequest $ request ) { if ( in_array ( $ request -> getMethod ( ) , [ 'PUT' , 'POST' , 'DELETE' , 'PATCH' ] ) || $ request -> getData ( ) ) { $ this -> _validateToken ( $ request ) ; $ body = $ request -> getParsedBody ( ) ; if ( is_array ( $ body ) ) { unset ( $ body [ $ this -> _config [ 'field' ] ] ) ; $ request = $ request -> withParsedBody ( $ body ) ; } } return $ request ; }
docstring: Checks if the request is POST, PUT, DELETE or PATCH and validates the CSRF token
  
  @param \Cake\Http\ServerRequest $request The request object.
  @return \Cake\Http\ServerRequest
docstring_tokens: Checks if the request is POST PUT DELETE or PATCH and validates the CSRF token