You are here

abstract class FileLoader in Plug 7

Same name in this branch
  1. 7 lib/Symfony/translation/Loader/FileLoader.php \Symfony\Component\Translation\Loader\FileLoader
  2. 7 lib/Symfony/validator/Symfony/Component/Validator/Mapping/Loader/FileLoader.php \Symfony\Component\Validator\Mapping\Loader\FileLoader

Base loader for loading validation metadata from a file.

@author Bernhard Schussek <bschussek@gmail.com>

Hierarchy

Expanded class hierarchy of FileLoader

See also

YamlFileLoader

XmlFileLoader

File

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

Namespace

Symfony\Component\Validator\Mapping\Loader
View source
abstract class FileLoader extends AbstractLoader {

  /**
   * The file to load.
   *
   * @var string
   */
  protected $file;

  /**
   * Creates a new loader.
   *
   * @param string $file The mapping file to load
   *
   * @throws MappingException If the file does not exist or is not readable
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AbstractLoader::$namespaces protected property
AbstractLoader::addNamespaceAlias protected function Adds a namespace alias.
AbstractLoader::DEFAULT_NAMESPACE constant The namespace to load constraints from by default.
AbstractLoader::newConstraint protected function Creates a new constraint instance for the given constraint name.
FileLoader::$file protected property The file to load.
FileLoader::__construct public function Creates a new loader.
LoaderInterface::loadClassMetadata public function Loads validation metadata into a {@link ClassMetadata} instance. 6