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
26 * @param string $file The mapping file to load
28 * @throws MappingException if the mapping file does not exist or is not readable
30 public function __construct($file)
32 if (!is_file($file)) {
33 throw new MappingException(sprintf('The mapping file %s does not exist', $file));
36 if (!is_readable($file)) {
37 throw new MappingException(sprintf('The mapping file %s is not readable', $file));