original_string: protected function _makeRoute($route, $defaults, $options)
      {
          if (is_string($route)) {
              $routeClass = App::className($options['routeClass'], 'Routing/Route');
              if ($routeClass === false) {
                  throw new InvalidArgumentException(sprintf(
                      'Cannot find route class %s',
                      $options['routeClass']
                  ));
              }
  
              $route = str_replace('//', '/', $this->_path . $route);
              if ($route !== '/') {
                  $route = rtrim($route, '/');
              }
  
              foreach ($this->_params as $param => $val) {
                  if (isset($defaults[$param]) && $param !== 'prefix' && $defaults[$param] !== $val) {
                      $msg = 'You cannot define routes that conflict with the scope. ' .
                          'Scope had %s = %s, while route had %s = %s';
                      throw new BadMethodCallException(sprintf(
                          $msg,
                          $param,
                          $val,
                          $param,
                          $defaults[$param]
                      ));
                  }
              }
              $defaults += $this->_params + ['plugin' => null];
              if (!isset($defaults['action']) && !isset($options['action'])) {
                  $defaults['action'] = 'index';
              }
  
              $route = new $routeClass($route, $defaults, $options);
          }
  
          if ($route instanceof Route) {
              return $route;
          }
          throw new InvalidArgumentException(
              'Route class not found, or route class is not a subclass of Cake\Routing\Route\Route'
          );
      }
code: protected function _makeRoute($route, $defaults, $options)
      {
          if (is_string($route)) {
              $routeClass = App::className($options['routeClass'], 'Routing/Route');
              if ($routeClass === false) {
                  throw new InvalidArgumentException(sprintf(
                      'Cannot find route class %s',
                      $options['routeClass']
                  ));
              }
  
              $route = str_replace('//', '/', $this->_path . $route);
              if ($route !== '/') {
                  $route = rtrim($route, '/');
              }
  
              foreach ($this->_params as $param => $val) {
                  if (isset($defaults[$param]) && $param !== 'prefix' && $defaults[$param] !== $val) {
                      $msg = 'You cannot define routes that conflict with the scope. ' .
                          'Scope had %s = %s, while route had %s = %s';
                      throw new BadMethodCallException(sprintf(
                          $msg,
                          $param,
                          $val,
                          $param,
                          $defaults[$param]
                      ));
                  }
              }
              $defaults += $this->_params + ['plugin' => null];
              if (!isset($defaults['action']) && !isset($options['action'])) {
                  $defaults['action'] = 'index';
              }
  
              $route = new $routeClass($route, $defaults, $options);
          }
  
          if ($route instanceof Route) {
              return $route;
          }
          throw new InvalidArgumentException(
              'Route class not found, or route class is not a subclass of Cake\Routing\Route\Route'
          );
      }
code_tokens: protected function _makeRoute ( $ route , $ defaults , $ options ) { if ( is_string ( $ route ) ) { $ routeClass = App :: className ( $ options [ 'routeClass' ] , 'Routing/Route' ) ; if ( $ routeClass === false ) { throw new InvalidArgumentException ( sprintf ( 'Cannot find route class %s' , $ options [ 'routeClass' ] ) ) ; } $ route = str_replace ( '//' , '/' , $ this -> _path . $ route ) ; if ( $ route !== '/' ) { $ route = rtrim ( $ route , '/' ) ; } foreach ( $ this -> _params as $ param => $ val ) { if ( isset ( $ defaults [ $ param ] ) && $ param !== 'prefix' && $ defaults [ $ param ] !== $ val ) { $ msg = 'You cannot define routes that conflict with the scope. ' . 'Scope had %s = %s, while route had %s = %s' ; throw new BadMethodCallException ( sprintf ( $ msg , $ param , $ val , $ param , $ defaults [ $ param ] ) ) ; } } $ defaults += $ this -> _params + [ 'plugin' => null ] ; if ( ! isset ( $ defaults [ 'action' ] ) && ! isset ( $ options [ 'action' ] ) ) { $ defaults [ 'action' ] = 'index' ; } $ route = new $ routeClass ( $ route , $ defaults , $ options ) ; } if ( $ route instanceof Route ) { return $ route ; } throw new InvalidArgumentException ( 'Route class not found, or route class is not a subclass of Cake\Routing\Route\Route' ) ; }
docstring: Create a route object, or return the provided object.
  
  @param string|\Cake\Routing\Route\Route $route The route template or route object.
  @param array $defaults Default parameters.
  @param array $options Additional options parameters.
  @return \Cake\Routing\Route\Route
  @throws \InvalidArgumentException when route class or route object is invalid.
  @throws \BadMethodCallException when the route to make conflicts with the current scope
docstring_tokens: Create a route object or return the provided object .