You are here

public function FileLoader::__construct in Plug 7

Creates a new loader.

Parameters

string $file The mapping file to load:

Throws

MappingException If the file does not exist or is not readable

File

lib/Symfony/validator/Symfony/Component/Validator/Mapping/Loader/FileLoader.php, line 40

Class

FileLoader
Base loader for loading validation metadata from a file.

Namespace

Symfony\Component\Validator\Mapping\Loader

Code

public function __construct($file) {
  if (!is_file($file)) {
    throw new MappingException(sprintf('The mapping file "%s" does not exist', $file));
  }
  if (!is_readable($file)) {
    throw new MappingException(sprintf('The mapping file "%s" is not readable', $file));
  }
  if (!stream_is_local($this->file)) {
    throw new MappingException(sprintf('The mapping file "%s" is not a local file', $file));
  }
  $this->file = $file;
}