You are here

public function LoaderChain::__construct in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/validator/Mapping/Loader/LoaderChain.php \Symfony\Component\Validator\Mapping\Loader\LoaderChain::__construct()
  2. 8 vendor/symfony/serializer/Mapping/Loader/LoaderChain.php \Symfony\Component\Serializer\Mapping\Loader\LoaderChain::__construct()
Same name and namespace in other branches
  1. 8.0 vendor/symfony/serializer/Mapping/Loader/LoaderChain.php \Symfony\Component\Serializer\Mapping\Loader\LoaderChain::__construct()

Accepts a list of LoaderInterface instances.

Parameters

LoaderInterface[] $loaders An array of LoaderInterface instances:

Throws

MappingException If any of the loaders does not implement LoaderInterface

File

vendor/symfony/serializer/Mapping/Loader/LoaderChain.php, line 42

Class

LoaderChain
Calls multiple {@link LoaderInterface} instances in a chain.

Namespace

Symfony\Component\Serializer\Mapping\Loader

Code

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_class($loader)));
    }
  }
  $this->loaders = $loaders;
}