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
34 * Creates a new loader.
36 * @param string $file The mapping file to load
38 * @throws MappingException If the file does not exist or is not readable
40 public function __construct($file)
42 if (!is_file($file)) {
43 throw new MappingException(sprintf('The mapping file "%s" does not exist', $file));
46 if (!is_readable($file)) {
47 throw new MappingException(sprintf('The mapping file "%s" is not readable', $file));
50 if (!stream_is_local($this->file)) {
51 throw new MappingException(sprintf('The mapping file "%s" is not a local file', $file));