protected function loadResource($resource, $required)
    {
        foreach ($this->loaders as $loader) {
            if (!$loader->supports($resource)) {
                continue;
            }

            try {
                return $loader->load($resource);
            } catch (ResourceNotFoundException $e) {
                if ($required) {
                    throw $e;
                }

                return [];
            }
        }

        throw new ResourceException(sprintf('There is no configuration loader available to load the resource "%s"', $resource));
    }
protected function loadResource($resource, $required)
    {
        foreach ($this->loaders as $loader) {
            if (!$loader->supports($resource)) {
                continue;
            }

            try {
                return $loader->load($resource);
            } catch (ResourceNotFoundException $e) {
                if ($required) {
                    throw $e;
                }

                return [];
            }
        }

        throw new ResourceException(sprintf('There is no configuration loader available to load the resource "%s"', $resource));
    }
protected function loadResource ( $ resource , $ required ) { foreach ( $ this -> loaders as $ loader ) { if ( ! $ loader -> supports ( $ resource ) ) { continue ; } try { return $ loader -> load ( $ resource ) ; } catch ( ResourceNotFoundException $ e ) { if ( $ required ) { throw $ e ; } return [ ] ; } } throw new ResourceException ( sprintf ( 'There is no configuration loader available to load the resource "%s"' , $ resource ) ) ; }
Load a resource using a loader. The first loader that supports
the resource will be used.

@param mixed $resource
@param bool  $required

@throws ResourceException

@return array
Load a resource using a loader . The first loader that supports the resource will be used .