예제 #1
0
 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;
 }
예제 #2
0
 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;
 }
예제 #3
0
파일: JsonDriver.php 프로젝트: jdrich/drest
 public function __construct($paths)
 {
     parent::__construct($paths);
 }