4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Validator\Mapping\Loader;
15 * Base loader for loading validation metadata from a list of files.
17 * @author Bulat Shakirzyanov <mallluhuct@gmail.com>
18 * @author Bernhard Schussek <bschussek@gmail.com>
20 * @see YamlFilesLoader
23 abstract class FilesLoader extends LoaderChain
26 * Creates a new loader.
28 * @param array $paths An array of file paths
30 public function __construct(array $paths)
32 parent::__construct($this->getFileLoaders($paths));
36 * Returns an array of file loaders for the given file paths.
38 * @param array $paths An array of file paths
40 * @return LoaderInterface[] The metadata loaders
42 protected function getFileLoaders($paths)
46 foreach ($paths as $path) {
47 $loaders[] = $this->getFileLoaderInstance($path);
54 * Creates a loader for the given file path.
56 * @param string $path The file path
58 * @return LoaderInterface The created loader
60 abstract protected function getFileLoaderInstance($path);