You are here

private function YamlFileLoader::parseFile in Plug 7

Loads the YAML class descriptions from the given file.

Parameters

string $path The path of the YAML file:

Return value

array|null The class descriptions or null, if the file was empty

Throws

\InvalidArgumentException If the file could not be loaded or did not contain a YAML array

1 call to YamlFileLoader::parseFile()
YamlFileLoader::loadClassMetadata in lib/Symfony/validator/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php
Loads validation metadata into a {@link ClassMetadata} instance.

File

lib/Symfony/validator/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php, line 118

Class

YamlFileLoader
Loads validation metadata from a YAML file.

Namespace

Symfony\Component\Validator\Mapping\Loader

Code

private function parseFile($path) {
  $classes = $this->yamlParser
    ->parse(file_get_contents($path));

  // empty file
  if (null === $classes) {
    return;
  }

  // not an array
  if (!is_array($classes)) {
    throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $this->file));
  }
  return $classes;
}