public function __construct($paths, $yaml) { parent::__construct($paths); $filename = self::$configuration_filepath . DIRECTORY_SEPARATOR . self::$configuration_filename; if (!file_exists($filename)) { throw new \RuntimeException('The configuration file does not exist at this path: ' . $filename); } $parsed = $yaml->parse(file_get_contents($filename)); if ($parsed == false) { throw new \RuntimeException('The configuration file does not have valid YAML: ' . $filename); } $this->classes = $parsed; }
public function __construct($paths) { parent::__construct($paths); $filename = self::$configuration_filepath . DIRECTORY_SEPARATOR . self::$configuration_filename; if (!file_exists($filename)) { throw new \RuntimeException('The configuration file does not exist at this path: ' . $filename); } $json = json_decode(file_get_contents($filename), true); if ($json == null) { throw new \RuntimeException('The configuration file does not have valid JSON: ' . $filename); } $entities = []; foreach ($json['resources'] as $resource) { $entity = $resource['entity']; $entities[$entity] = $resource; unset($entities[$entity]['entity']); } $this->classes = $entities; }
public function __construct($paths) { parent::__construct($paths); }