original_string: public function applyMiddleware(...$names)
      {
          foreach ($names as $name) {
              if (!$this->_collection->middlewareExists($name)) {
                  $message = "Cannot apply '$name' middleware or middleware group. " .
                      'Use registerMiddleware() to register middleware.';
                  throw new RuntimeException($message);
              }
          }
          $this->middleware = array_unique(array_merge($this->middleware, $names));
  
          return $this;
      }
code: public function applyMiddleware(...$names)
      {
          foreach ($names as $name) {
              if (!$this->_collection->middlewareExists($name)) {
                  $message = "Cannot apply '$name' middleware or middleware group. " .
                      'Use registerMiddleware() to register middleware.';
                  throw new RuntimeException($message);
              }
          }
          $this->middleware = array_unique(array_merge($this->middleware, $names));
  
          return $this;
      }
code_tokens: public function applyMiddleware ( ... $ names ) { foreach ( $ names as $ name ) { if ( ! $ this -> _collection -> middlewareExists ( $ name ) ) { $ message = "Cannot apply '$name' middleware or middleware group. " . 'Use registerMiddleware() to register middleware.' ; throw new RuntimeException ( $ message ) ; } } $ this -> middleware = array_unique ( array_merge ( $ this -> middleware , $ names ) ) ; return $ this ; }
docstring: Apply a middleware to the current route scope.
  
  Requires middleware to be registered via `registerMiddleware()`
  
  @param string ...$names The names of the middleware to apply to the current scope.
  @return $this
  @see \Cake\Routing\RouteCollection::addMiddlewareToScope()
docstring_tokens: Apply a middleware to the current route scope .