[DependencyInjection] use inheritdoc for loaders
This commit is contained in:
parent
ddd2fe2032
commit
63b8c07e5b
|
@ -36,23 +36,15 @@ class ClosureLoader extends Loader
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads a Closure.
|
||||
*
|
||||
* @param \Closure $closure The resource
|
||||
* @param string $type The resource type
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load($closure, $type = null)
|
||||
public function load($resource, $type = null)
|
||||
{
|
||||
call_user_func($closure, $this->container);
|
||||
call_user_func($resource, $this->container);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this class supports the given resource.
|
||||
*
|
||||
* @param mixed $resource A resource
|
||||
* @param string $type The resource type
|
||||
*
|
||||
* @return bool true if this class supports the given resource, false otherwise
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, $type = null)
|
||||
{
|
||||
|
|
|
@ -27,8 +27,8 @@ abstract class FileLoader extends BaseFileLoader
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
* @param FileLocatorInterface $locator A FileLocator instance
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
* @param FileLocatorInterface $locator A FileLocator instance
|
||||
*/
|
||||
public function __construct(ContainerBuilder $container, FileLocatorInterface $locator)
|
||||
{
|
||||
|
|
|
@ -22,22 +22,17 @@ use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
|||
class IniFileLoader extends FileLoader
|
||||
{
|
||||
/**
|
||||
* Loads a resource.
|
||||
*
|
||||
* @param mixed $file The resource
|
||||
* @param string $type The resource type
|
||||
*
|
||||
* @throws InvalidArgumentException When ini file is not valid
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load($file, $type = null)
|
||||
public function load($resource, $type = null)
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
$path = $this->locator->locate($resource);
|
||||
|
||||
$this->container->addResource(new FileResource($path));
|
||||
|
||||
$result = parse_ini_file($path, true);
|
||||
if (false === $result || array() === $result) {
|
||||
throw new InvalidArgumentException(sprintf('The "%s" file is not valid.', $file));
|
||||
throw new InvalidArgumentException(sprintf('The "%s" file is not valid.', $resource));
|
||||
}
|
||||
|
||||
if (isset($result['parameters']) && is_array($result['parameters'])) {
|
||||
|
@ -48,12 +43,7 @@ class IniFileLoader extends FileLoader
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if this class supports the given resource.
|
||||
*
|
||||
* @param mixed $resource A resource
|
||||
* @param string $type The resource type
|
||||
*
|
||||
* @return bool true if this class supports the given resource, false otherwise
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, $type = null)
|
||||
{
|
||||
|
|
|
@ -24,18 +24,15 @@ use Symfony\Component\Config\Resource\FileResource;
|
|||
class PhpFileLoader extends FileLoader
|
||||
{
|
||||
/**
|
||||
* Loads a PHP file.
|
||||
*
|
||||
* @param mixed $file The resource
|
||||
* @param string $type The resource type
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load($file, $type = null)
|
||||
public function load($resource, $type = null)
|
||||
{
|
||||
// the container and loader variables are exposed to the included file below
|
||||
$container = $this->container;
|
||||
$loader = $this;
|
||||
|
||||
$path = $this->locator->locate($file);
|
||||
$path = $this->locator->locate($resource);
|
||||
$this->setCurrentDir(dirname($path));
|
||||
$this->container->addResource(new FileResource($path));
|
||||
|
||||
|
@ -43,12 +40,7 @@ class PhpFileLoader extends FileLoader
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if this class supports the given resource.
|
||||
*
|
||||
* @param mixed $resource A resource
|
||||
* @param string $type The resource type
|
||||
*
|
||||
* @return bool true if this class supports the given resource, false otherwise
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, $type = null)
|
||||
{
|
||||
|
|
|
@ -30,14 +30,11 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException;
|
|||
class XmlFileLoader extends FileLoader
|
||||
{
|
||||
/**
|
||||
* Loads an XML file.
|
||||
*
|
||||
* @param mixed $file The resource
|
||||
* @param string $type The resource type
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load($file, $type = null)
|
||||
public function load($resource, $type = null)
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
$path = $this->locator->locate($resource);
|
||||
|
||||
$xml = $this->parseFile($path);
|
||||
$xml->registerXPathNamespace('container', 'http://symfony.com/schema/dic/services');
|
||||
|
@ -61,12 +58,7 @@ class XmlFileLoader extends FileLoader
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if this class supports the given resource.
|
||||
*
|
||||
* @param mixed $resource A resource
|
||||
* @param string $type The resource type
|
||||
*
|
||||
* @return bool true if this class supports the given resource, false otherwise
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, $type = null)
|
||||
{
|
||||
|
|
|
@ -32,14 +32,11 @@ class YamlFileLoader extends FileLoader
|
|||
private $yamlParser;
|
||||
|
||||
/**
|
||||
* Loads a Yaml file.
|
||||
*
|
||||
* @param mixed $file The resource
|
||||
* @param string $type The resource type
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load($file, $type = null)
|
||||
public function load($resource, $type = null)
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
$path = $this->locator->locate($resource);
|
||||
|
||||
$content = $this->loadFile($path);
|
||||
|
||||
|
@ -56,7 +53,7 @@ class YamlFileLoader extends FileLoader
|
|||
// parameters
|
||||
if (isset($content['parameters'])) {
|
||||
if (!is_array($content['parameters'])) {
|
||||
throw new InvalidArgumentException(sprintf('The "parameters" key should contain an array in %s. Check your YAML syntax.', $file));
|
||||
throw new InvalidArgumentException(sprintf('The "parameters" key should contain an array in %s. Check your YAML syntax.', $resource));
|
||||
}
|
||||
|
||||
foreach ($content['parameters'] as $key => $value) {
|
||||
|
@ -68,16 +65,11 @@ class YamlFileLoader extends FileLoader
|
|||
$this->loadFromExtensions($content);
|
||||
|
||||
// services
|
||||
$this->parseDefinitions($content, $file);
|
||||
$this->parseDefinitions($content, $resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this class supports the given resource.
|
||||
*
|
||||
* @param mixed $resource A resource
|
||||
* @param string $type The resource type
|
||||
*
|
||||
* @return bool true if this class supports the given resource, false otherwise
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, $type = null)
|
||||
{
|
||||
|
|
Reference in New Issue