@SuppressWarnings(PHPMD.UnusedFormalParameter)

@param mixed $resource
@param null  $type

@return RouteCollection
493837
public function load($resource, $type = null): RouteCollection
    {
        $resource = (string)$resource;
        if (in_array($resource, $this->descriptions)) {
            throw new \RuntimeException("Resource '$resource' was already loaded");
        }

        $description = $this->repository->get($resource);

        $routes           = new RouteCollection();
        $router           = $description->getExtension('router') ?: "$this->typeName.controller";
        $routerController = $description->getExtension('router-controller');

        foreach ($description->getPaths() as $pathItem) {
            $relativePath = ltrim($pathItem->getPath(), '/');
            $resourceName = strpos($relativePath, '/')
                ? substr($relativePath, 0, strpos($relativePath, '/'))
                : $relativePath;

            $routerController = $pathItem->getExtension('router-controller') ?: $routerController;

            foreach ($pathItem->getOperations() as $operation) {
                $controllerKey = $this->resolveControllerKey(
                    $operation,
                    $resourceName,
                    $router,
                    $routerController
                );
                $defaults      = [
                    '_controller'               => $controllerKey,
                    RequestMeta::ATTRIBUTE_URI  => $resource,
                    RequestMeta::ATTRIBUTE_PATH => $pathItem->getPath(),
                ];

                $route = new Route(
                    $pathItem->getPath(),
                    $defaults,
                    $this->resolveRequirements($operation),
                    [],
                    '',
                    $description->getSchemes()
                );
                $route->setMethods($operation->getMethod());
                $routes->add($this->createRouteId($resource, $pathItem->getPath(), $controllerKey), $route);
            }
        }

        $this->descriptions[] = $resource;

        return $routes;
    }
410795
public function setResource(ResourceInterface $resource = null)
    {
        $this->resource = $resource;

        // Clear urls
        $this->urls = null;

        return $this;
    }
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);
    }
756752
public function load($resource, $type = null)
    {
        $handler = $this->handler;
        if (is_array($resource)) {
            $rows = \DB::query(sprintf(
                "SELECT %s FROM `%s` %s",
                $resource[0],
                $resource[1],
                isset($resource[2]) ? "WHERE {$resource[2]}" : ''
            ));
            foreach ($rows as $index => $record) {
                if (empty($record['ClassName'])) {
                    throw new \RuntimeException("No classname in db record");
                }
                $handler(new $record['ClassName']($record), $index);
            }
        } else {
            throw new \InvalidArgumentException('Resource provided to DBClosureLoader is not an array');
        }
    }
1369162
public function getRouteCollection()
    {
        if (is_null($this->routeCollection)) {
            $this->routeCollection = new RouteCollection();
            $this->initRoutes();
        }

        return $this->routeCollection;
    }
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;
    }
876376
public function resolvePath($resource)
    {
        // Skip blank resources
        if (empty($resource)) {
            return null;
        }
        $resourceObj = $this->resolveResource($resource);
        if ($resourceObj instanceof ModuleResource) {
            return $resourceObj->getRelativePath();
        }
        return $resource;
    }
1267736
public function load($resource, $type = null)
    {
        $path = $this->locator->locate($resource);

        $config = Yaml::parse(file_get_contents($path));

        $processor        = new Processor();
        $stateStorageConf = new StateStorageConfiguration();
        $pathConf         = new PathsConfiguration();

        $stateStorage = $processor->processConfiguration(
            $stateStorageConf,
            array('state_storage' => $config['state_storage'])
        );

        foreach ($stateStorage as $key => $value) {
            $this->container->setParameter("state_storage.{$key}", $value);
        }

        $paths = $processor->processConfiguration($pathConf, array('paths' => $config['paths']));
        foreach ($paths as $key => $value) {
            $this->container->setParameter("{$key}_dir", $value);
        }

        try {
            $this->import('config_local.yml');
        } catch (FileLoaderLoadException $e) {
        }
    }
174566
public function router($resource, $arguments)
	{
		// if this is an ajax call
		if ($this->is_restful())
		{
			// have the Controller_Rest router deal with it
			return parent::router($resource, $arguments);
		}

		// check if a input specific method exists
		$controller_method = strtolower(\Input::method()) . '_' . $resource;

		// fall back to action_ if no rest method is provided
		if ( ! method_exists($this, $controller_method))
		{
			$controller_method = 'action_'.$resource;
		}

		// check if the action method exists
		if (method_exists($this, $controller_method))
		{
			return call_fuel_func_array(array($this, $controller_method), $arguments);
		}

		// if not, we got ourselfs a genuine 404!
		throw new \HttpNotFoundException();
	}
235957
public static function fromResource(Resource $resource)
    {
        if (isset($resource->query['with_billets'])) {
            return static::withBillets($resource);
        }
        return parent::fromResource($resource);
    }
193782
public function load($resource, $type = null): array
    {
        try {
            $path = $this->locator->locate($resource);
            $file = $this->filesystem->openFile($path);
            $configValues = $this->yamlParser->parse($file->getContents());

            return $configValues;
        } catch (FileLocatorFileNotFoundException $error) {
            return [];
        }
    }
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;
	}
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));
    }
835365
public function load($resource, $type = null)
    {
        $routes = new RouteCollection();

        foreach ($this->pool->getControllers() as $controllerKey => $controller) {
            /** @var CrudController $controller */
            foreach ($controller->getActions() as $actionKey => $action) {
                /** @var ActionInterface $action */
                $options = $action->getOptions();

                $pattern = rtrim($controller->getRoutePrefix() . $options['pattern'], '/');

                $defaults = $options['defaults'];
                $defaults['_controller'] = $controllerKey . ':' . 'callAction';
                $defaults['_action'] = $actionKey;

                $route = new Route(
                    $pattern,
                    $defaults,
                    $options['requirements'],
                    $options['options'],
                    $options['host'],
                    $options['schemes'],
                    $options['methods'],
                    $options['condition']
                );

                $routeSuffix = (empty($options['route_suffix']) ? $actionKey : $options['route_suffix']);
                $routes->add($controllerKey . '.' . $routeSuffix, $route);
            }
        }

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

        foreach (array_keys($this->serviceIds) as $serviceId) {
            $routeLoader = $this->container->get($serviceId);
            if ($routeLoader instanceof RouteLoaderAbstract) {
                $yamlFile = $routeLoader->loadYamlFile();
                if (is_null($yamlFile)) {
                    $routes->addCollection($routeLoader->load($routeLoader->getResourceName()));
                } else {
                    $routes->addCollection($this->import($yamlFile, 'yaml'));
                }
            }
        }

        return $routes;
    }
1178469
public function shallow(self $resource)
    {
        $newResource = new self;
        $resource->forget();
        $routes = $resource->all();

        foreach ($routes as $route) {
            if (strpos("index make create", $route->getAction()[1]) !== false) {
                $newResource->set($route);
            }
        }

        return $this->nest($newResource);
    }
204376
public static function collection($resource)
    {
        return tap(new AnonymousResourceCollection($resource, static::class), function ($collection) {
            if (property_exists(static::class, 'preserveKeys')) {
                $collection->preserveKeys = (new static([]))->preserveKeys === true;
            }
        });
    }