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;
14 use Symfony\Component\Validator\Exception\MappingException;
17 * Base loader for loading validation metadata from a file.
19 * @author Bernhard Schussek <bschussek@gmail.com>
24 abstract class FileLoader extends AbstractLoader
29 * Creates a new loader.
31 * @param string $file The mapping file to load
33 * @throws MappingException If the file does not exist or is not readable
35 public function __construct($file)
37 if (!is_file($file)) {
38 throw new MappingException(sprintf('The mapping file "%s" does not exist', $file));
41 if (!is_readable($file)) {
42 throw new MappingException(sprintf('The mapping file "%s" is not readable', $file));
45 if (!stream_is_local($this->file)) {
46 throw new MappingException(sprintf('The mapping file "%s" is not a local file', $file));