Loads a resource.

@param mixed  $resource The resource
@param string $type     The resource type

@return RouteCollection

@throws \RuntimeException Loader is added twice
7006
public function load($resource, $type = null)
    {
        if ($this->loaded) {
            throw new \RuntimeException('Do not add this loader twice');
        }

        $collection = new RouteCollection();

        foreach ($this->container->getParameter('smart_core_cms.modules') as $moduleName => $module) {
            $resource = $module['path'].'/Resources/config/routing_admin.yml';
            if (file_exists($resource)) {
                $importedRoutes = $this->import('@'.$moduleName.'ModuleBundle/Resources/config/routing_admin.yml', 'yaml');
                $importedRoutes->addPrefix($moduleName);

                $collection->addCollection($importedRoutes);
            }
        }

        return $collection;
    }
704481
public function getResolverForResource($resource, $type = null){
		if(is_string($resource) && $resource[0] === '/'){
			$dir = dirname($resource);
			$resolver = $this->getResolverForPath($dir);
		}else{
			$resolver = $this->getResolver();
		}
		return $resolver;
	}
921109
public function load($resource, $type = null)
    {
        $path = $this->locator->locate($resource);
        $this->container->addResource(new FileResource($path));

        $file = new JsonFile($path);
        $content = $file->read();
        $extension = pathinfo($resource, PATHINFO_FILENAME);

        if (array_key_exists('parameters', $content)) {
            foreach ($content['parameters'] as $name => $parameter) {
                $this->container->setParameter($name, $parameter);
            }

            unset($content['parameters']);
        }

        if (array_key_exists('imports', $content)) {
            foreach ($content['imports'] as $import) {
                $importFilename = $import;
                if (!Path::isAbsolute($importFilename)) {
                    $importFilename = Path::join([dirname($path), $import]);
                }

                $this->import($importFilename, null, false, $file);
            }

            unset($content['imports']);
        }

        $this->container->loadFromExtension($extension, $content);
    }
1138966
private function load($resource, string $type = null): array
    {
        if (null === $this->loader) {
            throw new \BadMethodCallException('Cannot import other routing resources: you must pass a LoaderInterface when constructing RouteCollectionBuilder.');
        }

        if ($this->loader->supports($resource, $type)) {
            $collections = $this->loader->load($resource, $type);

            return \is_array($collections) ? $collections : [$collections];
        }

        if (null === $resolver = $this->loader->getResolver()) {
            throw new LoaderLoadException($resource, null, null, null, $type);
        }

        if (false === $loader = $resolver->resolve($resource, $type)) {
            throw new LoaderLoadException($resource, null, null, null, $type);
        }

        $collections = $loader->load($resource, $type);

        return \is_array($collections) ? $collections : [$collections];
    }
445711
public function load($routingResource, $type = null)
    {
        if ($this->loaded) {
            throw new RuntimeException('Do not add the Admin "extra" loader twice');
        }
        $routes = new RouteCollection();

        foreach ($this->resourceCollection->all() as $name => $resource) {
            $configuration = $this
                ->configurationFactory
                ->createAdminConfiguration(
                    $resource->getName(),
                    $resource->getConfiguration(),
                    $this->applicationConfiguration
                )
            ;

            foreach ($configuration->getParameter('actions') as $actionName => $actionData) {
                $actionConfiguration = $this
                    ->configurationFactory
                    ->createActionConfiguration($actionName, $actionData, $name, $configuration)
                ;
                $route = new Route(
                    $actionConfiguration->getParameter('route_path'),
                    $actionConfiguration->getParameter('route_defaults'),
                    $actionConfiguration->getParameter('route_requirements')
                );
                $routes->add($actionConfiguration->getParameter('route'), $route);
            }

            if ($this->applicationConfiguration->getParameter('enable_homepage')) {
                $route = new Route('/', ['_controller' => HomeAction::class], []);
                $routes->add('lag.admin.homepage', $route);
            }
        }

        return $routes;
    }
594636
public function load($resource, $type = null)
    {
        $collection = new RouteCollection();
        $controllers = $this->controllerFinder->getAllControllerFromResource($resource);
        /** @var \ReflectionClass $controller */
        foreach ($controllers as $controller) {
            if (!$controller) {
                //bugfix for windows OS
                continue;
            }

            if ($controller->isSubclassOf(CrudController::class) || $controller->getName() === HomeController::class || $controller->getName() === ProfileController::class) {
                $this->registerRoute($collection, $controller);
            } else {
                $collection->addCollection(parent::load($resource, 'annotation'));
            }
        }

        return $collection;
    }
107077
public function supports($resource, $type = null)
    {
        if (is_string($resource)) {
            if ($this->isFile($resource)) {
                return $this->validateExtension($resource);
            } else {
                return $this->isJson($resource);
            }
        }

        return false;
    }
159630
final public function load(string $namespace, string $resource): PrototypeConfigurator
    {
        $this->__destruct();

        return $this->parent->load($namespace, $resource);
    }
45519
public function resolve($resource, $type = null){
		$resolvingLoader = false;
		foreach($this->loaders as $loader){
			if($loader->supports($resource, $type)){
				$resolvingLoader = $loader;
			}
		}
		if(!$resolvingLoader){
			if(!$type){
				$type = (is_callable($resource))
					? 'closure'
					: pathinfo($resource, PATHINFO_EXTENSION)
				;
			}
			$resolvingLoader = $this->createLoaderForType($type);
		}

		return $resolvingLoader;
	}
1086796
public function load($resource, $type = null)
    {
        if ($this->loaded) {
            throw new RuntimeException('Do not add this loader twice');
        }

        $routes = new RouteCollection();

        $routes->add($this->inputControllerRouteName, new Route($this->inputResizeControllerRoute, [
            '_controller' => 'elcodi.controller.metric_input:addEntryAction',
        ]));

        $this->loaded = true;

        return $routes;
    }
302134
public function watch($resource)
    {
        if (!$this->files->exists($resource)) {
            throw new RuntimeException('Resource must exist before you can watch it.');
        } elseif ($this->files->isDirectory($resource)) {
            $resource = new DirectoryResource(new SplFileInfo($resource), $this->files);

            $resource->setupDirectory();
        } else {
            $resource = new FileResource(new SplFileInfo($resource), $this->files);
        }

        // The listener gives users the ability to bind listeners on the events
        // created when watching a file or directory. We'll give the listener
        // to the tracker so the tracker can fire any bound listeners.
        $listener = new Listener();

        $this->tracker->register($resource, $listener);

        return $listener;
    }
622764
public function load($resource, $type = null)
    {
        $routes = $this->loader->load($resource, $type);

        if (!$routes instanceof RouteCollection) {
            throw new \UnexpectedValueException(\sprintf('Decorated route loader is expected to return an instance of %s.', RouteCollection::class));
        }

        foreach ($routes->all() as $name => $route) {
            /** @var Route $route */
            if (null === $variable = $route->getOption('prefix_variable')) {
                continue;
            }

            if (!$route->hasDefault($variable)) {
                throw new \LogicException(\sprintf('Route "%s" with optional prefix "/{%s}" must have a default value for "%2$s".', $name, $variable));
            }

            $path = \sprintf('/{%s}%s', $variable, \ltrim($route->getPath(), '/'));
            $requirement = \sprintf('(%s)/|', $route->getRequirement($variable) ?? '[^/]+');

            $route
                ->setPath($path)
                ->setRequirement($variable, $requirement);
        }

        return $routes;
    }
163092
public function load($resource, $type = null)
    {
        $collection = new RouteCollection();

        if ($this->components != null) {
            foreach ($this->components as $componentName => $component) {
                if (!isset($component['bundle'])) {
                    continue;
                }

                $bundleClassName = preg_replace('/^.*\\\/', '', $component['bundle']);
                $resource = '@' . $bundleClassName . '/Resources/config/routing.yml';
                $type = 'yaml';

                /** @var RouteCollection $importedRoutes */
                $importedRoutes = $this->import($resource, $type);

                foreach ($importedRoutes as $route) {
                    /** @var Route $route */
                    if (!strstr($route->getPath(), $componentName)) {
                        $route->setPath('/'. $componentName . $route->getPath());
                    }
                }

                $collection->addCollection($importedRoutes);
            }
        }

        return $collection;
    }
39844
public function addResource($resource, string $type = 'file'): void
    {
        if (is_array($resource)) {
            $this->addResourceArray($resource);
            return;
        }

        if (is_string($resource)) {
            switch ($type) {
                case 'json':
                    $this->addResourceString($resource);
                    break;
                case 'file':
                    $this->addResourceFile($resource);
                    break;
                default:
                    throw new \InvalidArgumentException("Invalid resource type");
            }
        }
    }
399234
public function load($resource, $type = null) 
    {
        $path = $this->locator->locate($resource);
        
        if (!stream_is_local($path)) {
            throw new \InvalidArgumentException(sprintf('This is not a local file "%s".', $path));
        }

        if (!file_exists($path)) {
            throw new \InvalidArgumentException(sprintf('File "%s" not found.', $path));
        }

        $returnArray = include $path;
        
        if(false === is_array($returnArray)) {
            throw ConfigException::configNotArray($path);
        }
        
        $this->loaded[$resource] = $path;
        
        return $returnArray;
    }
470286
public function load($resource, $type = null)
    {
        if ($this->loaded) {

            throw new \RuntimeException('Do not add this loader twice');
        }

        $routes = new RouteCollection();
        $routes->add($this->controllerRouteName, new Route($this->controllerRoute, array(
            '_controller'   =>  'PaymillBundle:Paymill:execute',
        ), array(), array(), '', array(), array(
            'POST'
        )));

        $this->loaded = true;

        return $routes;
    }
415098
public function load($resource, $type = null) 
    {
        $path = $this->locator->locate($resource);
        
        if (!stream_is_local($path)) {
            throw new \InvalidArgumentException(sprintf('This is not a local file "%s".', $path));
        }

        if (!file_exists($path)) {
            throw new \InvalidArgumentException(sprintf('File "%s" not found.', $path));
        }
        
        $this->loaded[$resource] = $path;

        return Yaml::parse(file_get_contents($path));
    }