private function getTemplates($dir) { $data = array(); foreach (glob(__DIR__ . '/' . __CLASS__ . "/{$dir}/*.template.json") as $template_path) { preg_match('|([^/]+)\\.template\\.json$|', $template_path, $m); $name = $m[1]; $structure_path = str_replace('.template.json', '.structure.json', $template_path); $values_path = str_replace('.template.json', '.values.json', $template_path); $data[] = array($name, DataTemplate::fromJsonFile($template_path), json_decode(file_get_contents($structure_path)), file_exists($values_path) ? json_decode(file_get_contents($values_path), true) : array()); } return $data; }
protected static function getFhirTemplate() { return \DataTemplate::fromJsonFile(__DIR__ . '/fhir_templates/Practice.json', array('system_uri_practice_code' => \Yii::app()->params['fhir_system_uris']['practice_code'])); }
protected static function getFhirTemplate() { return \DataTemplate::fromJsonFile(__DIR__ . '/fhir_templates/CommissioningBody.json', array('system_uri_cb_code' => \Yii::app()->params['fhir_system_uris']['cb_code'])); }
protected static function getFhirTemplate() { $class = new \ReflectionClass(get_called_class()); $path = dirname($class->getFileName()) . '/fhir_templates/' . $class->getShortName() . '.json'; return \DataTemplate::fromJsonFile($path); }
protected static function getFhirTemplate() { return \DataTemplate::fromJsonFile(__DIR__ . '/fhir_templates/Patient.json', array('system_uri_nhs_num' => \Yii::app()->params['fhir_system_uris']['nhs_num'], 'system_uri_hos_num' => \Yii::app()->params['fhir_system_uris']['hos_num'])); }
/** * @expectedException Exception * @expectedExceptionMessage Missing template constant: 'const1' */ public function testMissingConstant() { DataTemplate::fromJsonFile(__DIR__ . '/' . __CLASS__ . '/generate-match/const.template.json'); }