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\Serializer\Mapping\Loader;
14 use Symfony\Component\Serializer\Exception\MappingException;
17 * Base class for all file based loaders.
19 * @author Kévin Dunglas <dunglas@gmail.com>
21 abstract class FileLoader implements LoaderInterface
31 * @param string $file The mapping file to load
33 * @throws MappingException if the mapping 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));