You are here

protected function MigrateSourceYaml::parse in Migrate Source YAML 7

Parse the source YAML file.

Throws

Exception On not finding the provided list in the source data.

1 call to MigrateSourceYaml::parse()
MigrateSourceYaml::__construct in includes/MigrateSourceYaml.inc
Construct a new YAML source object.

File

includes/MigrateSourceYaml.inc, line 109
Contains MigrateSourceYaml.

Class

MigrateSourceYaml
Migrate source class to import from a YAML file.

Code

protected function parse() {
  $yaml = file_get_contents($this->file);
  $parsed = $this->yamlParser
    ->parse($yaml);
  if (isset($parsed[$this->list])) {
    $this->data = $parsed[$this->list];
  }
  else {
    throw new Exception('The list provided to MigrateSourceYaml does not exist in the YAML file specified.');
  }
}