original_string: public function load($resource, $type = null)
      {
          if (!preg_match('/^[^\:]+(?:::?(?:[^\:]+))?$/', $resource)) {
              throw new \InvalidArgumentException(sprintf('Invalid resource "%s" passed to the "service" route loader: use the format "service::method" or "service" if your service has an "__invoke" method.', $resource));
          }
  
          if (1 === substr_count($resource, ':')) {
              $resource = str_replace(':', '::', $resource);
              @trigger_error(sprintf('Referencing service route loaders with a single colon is deprecated since Symfony 4.1. Use %s instead.', $resource), E_USER_DEPRECATED);
          }
  
          $parts = explode('::', $resource);
          $serviceString = $parts[0];
          $method = $parts[1] ?? '__invoke';
  
          $loaderObject = $this->getServiceObject($serviceString);
  
          if (!\is_object($loaderObject)) {
              throw new \LogicException(sprintf('%s:getServiceObject() must return an object: %s returned', \get_class($this), \gettype($loaderObject)));
          }
  
          if (!\is_callable([$loaderObject, $method])) {
              throw new \BadMethodCallException(sprintf('Method "%s" not found on "%s" when importing routing resource "%s"', $method, \get_class($loaderObject), $resource));
          }
  
          $routeCollection = $loaderObject->$method($this);
  
          if (!$routeCollection instanceof RouteCollection) {
              $type = \is_object($routeCollection) ? \get_class($routeCollection) : \gettype($routeCollection);
  
              throw new \LogicException(sprintf('The %s::%s method must return a RouteCollection: %s returned', \get_class($loaderObject), $method, $type));
          }
  
          // make the service file tracked so that if it changes, the cache rebuilds
          $this->addClassResource(new \ReflectionClass($loaderObject), $routeCollection);
  
          return $routeCollection;
      }
code: public function load($resource, $type = null)
      {
          if (!preg_match('/^[^\:]+(?:::?(?:[^\:]+))?$/', $resource)) {
              throw new \InvalidArgumentException(sprintf('Invalid resource "%s" passed to the "service" route loader: use the format "service::method" or "service" if your service has an "__invoke" method.', $resource));
          }
  
          if (1 === substr_count($resource, ':')) {
              $resource = str_replace(':', '::', $resource);
              @trigger_error(sprintf('Referencing service route loaders with a single colon is deprecated since Symfony 4.1. Use %s instead.', $resource), E_USER_DEPRECATED);
          }
  
          $parts = explode('::', $resource);
          $serviceString = $parts[0];
          $method = $parts[1] ?? '__invoke';
  
          $loaderObject = $this->getServiceObject($serviceString);
  
          if (!\is_object($loaderObject)) {
              throw new \LogicException(sprintf('%s:getServiceObject() must return an object: %s returned', \get_class($this), \gettype($loaderObject)));
          }
  
          if (!\is_callable([$loaderObject, $method])) {
              throw new \BadMethodCallException(sprintf('Method "%s" not found on "%s" when importing routing resource "%s"', $method, \get_class($loaderObject), $resource));
          }
  
          $routeCollection = $loaderObject->$method($this);
  
          if (!$routeCollection instanceof RouteCollection) {
              $type = \is_object($routeCollection) ? \get_class($routeCollection) : \gettype($routeCollection);
  
              throw new \LogicException(sprintf('The %s::%s method must return a RouteCollection: %s returned', \get_class($loaderObject), $method, $type));
          }
  
          // make the service file tracked so that if it changes, the cache rebuilds
          $this->addClassResource(new \ReflectionClass($loaderObject), $routeCollection);
  
          return $routeCollection;
      }
code_tokens: public function load ( $ resource , $ type = null ) { if ( ! preg_match ( '/^[^\:]+(?:::?(?:[^\:]+))?$/' , $ resource ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Invalid resource "%s" passed to the "service" route loader: use the format "service::method" or "service" if your service has an "__invoke" method.' , $ resource ) ) ; } if ( 1 === substr_count ( $ resource , ':' ) ) { $ resource = str_replace ( ':' , '::' , $ resource ) ; @ trigger_error ( sprintf ( 'Referencing service route loaders with a single colon is deprecated since Symfony 4.1. Use %s instead.' , $ resource ) , E_USER_DEPRECATED ) ; } $ parts = explode ( '::' , $ resource ) ; $ serviceString = $ parts [ 0 ] ; $ method = $ parts [ 1 ] ?? '__invoke' ; $ loaderObject = $ this -> getServiceObject ( $ serviceString ) ; if ( ! \ is_object ( $ loaderObject ) ) { throw new \ LogicException ( sprintf ( '%s:getServiceObject() must return an object: %s returned' , \ get_class ( $ this ) , \ gettype ( $ loaderObject ) ) ) ; } if ( ! \ is_callable ( [ $ loaderObject , $ method ] ) ) { throw new \ BadMethodCallException ( sprintf ( 'Method "%s" not found on "%s" when importing routing resource "%s"' , $ method , \ get_class ( $ loaderObject ) , $ resource ) ) ; } $ routeCollection = $ loaderObject -> $ method ( $ this ) ; if ( ! $ routeCollection instanceof RouteCollection ) { $ type = \ is_object ( $ routeCollection ) ? \ get_class ( $ routeCollection ) : \ gettype ( $ routeCollection ) ; throw new \ LogicException ( sprintf ( 'The %s::%s method must return a RouteCollection: %s returned' , \ get_class ( $ loaderObject ) , $ method , $ type ) ) ; } // make the service file tracked so that if it changes, the cache rebuilds $ this -> addClassResource ( new \ ReflectionClass ( $ loaderObject ) , $ routeCollection ) ; return $ routeCollection ; }
docstring: Calls the service that will load the routes.
  
  @param string      $resource Some value that will resolve to a callable
  @param string|null $type     The resource type
  
  @return RouteCollection
docstring_tokens: Calls the service that will load the routes .