original_string: public function matches(Event $event)
      {
          /* @var \Cake\Http\ServerRequest $request */
          $request = $event->getData('request');
          $pass = true;
          if (!empty($this->_config['for'])) {
              $len = strlen('preg:');
              $for = $this->_config['for'];
              $url = $request->getRequestTarget();
              if (substr($for, 0, $len) === 'preg:') {
                  $pass = (bool)preg_match(substr($for, $len), $url);
              } else {
                  $pass = strpos($url, $for) === 0;
              }
          }
          if ($pass && !empty($this->_config['when'])) {
              $response = $event->getData('response');
              $pass = $this->_config['when']($request, $response);
          }
  
          return $pass;
      }
code: public function matches(Event $event)
      {
          /* @var \Cake\Http\ServerRequest $request */
          $request = $event->getData('request');
          $pass = true;
          if (!empty($this->_config['for'])) {
              $len = strlen('preg:');
              $for = $this->_config['for'];
              $url = $request->getRequestTarget();
              if (substr($for, 0, $len) === 'preg:') {
                  $pass = (bool)preg_match(substr($for, $len), $url);
              } else {
                  $pass = strpos($url, $for) === 0;
              }
          }
          if ($pass && !empty($this->_config['when'])) {
              $response = $event->getData('response');
              $pass = $this->_config['when']($request, $response);
          }
  
          return $pass;
      }
code_tokens: public function matches ( Event $ event ) { /* @var \Cake\Http\ServerRequest $request */ $ request = $ event -> getData ( 'request' ) ; $ pass = true ; if ( ! empty ( $ this -> _config [ 'for' ] ) ) { $ len = strlen ( 'preg:' ) ; $ for = $ this -> _config [ 'for' ] ; $ url = $ request -> getRequestTarget ( ) ; if ( substr ( $ for , 0 , $ len ) === 'preg:' ) { $ pass = ( bool ) preg_match ( substr ( $ for , $ len ) , $ url ) ; } else { $ pass = strpos ( $ url , $ for ) === 0 ; } } if ( $ pass && ! empty ( $ this -> _config [ 'when' ] ) ) { $ response = $ event -> getData ( 'response' ) ; $ pass = $ this -> _config [ 'when' ] ( $ request , $ response ) ; } return $ pass ; }
docstring: Check to see if the incoming request matches this filter's criteria.
  
  @param \Cake\Event\Event $event The event to match.
  @return bool
docstring_tokens: Check to see if the incoming request matches this filter s criteria .