- md5
- 2bad679e9315c96791727eb809857634
- sha1
- 638e9d4c647eb75fe0e25add71da8f244f6da274
- sha256
- 66a470ca6080efc432fffcbbb4f8c25132e3a8cdcee424c05b767ec7d1c2aa3e
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Mapping\Loader;
use Symfony\Component\Validator\Exception\MappingException;
use Symfony\Component\Validator\Mapping\ClassMetadata;
/**
* Loads validation metadata from multiple {@link LoaderInterface} instances.
*
* Pass the loaders when constructing the chain. Once
* {@link loadClassMetadata()} is called, that method will be called on all
* loaders in the chain.
*
* @author Bernhard Schussek <[email protected]>
*/
class LoaderChain implements LoaderInterface
{
protected $loaders;
/**
* @param LoaderInterface[] $loaders The metadata loaders to use
*
* @throws MappingException If any of the loaders has an invalid type
*/
public function __construct(array $loaders)
{
foreach ($loaders as $loader) {
if (!$loader instanceof LoaderInterface) {
throw new MappingException(\sprintf('Class "%s" is expected to implement LoaderInterface.', get_debug_type($loader)));
}
}
$this->loaders = $loaders;
}
public function loadClassMetadata(ClassMetadata $metadata): bool
{
$success = false;
foreach ($this->loaders as $loader) {
$success = $loader->loadClassMetadata($metadata) || $success;
}
return $success;
}
/**
* @return LoaderInterface[]
*/
public function getLoaders(): array
{
return $this->loaders;
}
}
The same content is in 70 releases, Joomla 5.4.0-rc1 to 6.2.1-rc1. See them all, or every version of this file.