When more than one file path is provided to the constructor, data from
all files will be parsed and merged according to the inheritance rules defined
in CLDR specification. Aliases are also resolved correctly.
/** * @test */ public function returnsAttributeValueCorrectly() { $sampleNodeString = 'dateFormatLength[@type="medium"][@alt="proposed"]'; $this->assertEquals('medium', $this->model->getAttributeValue($sampleNodeString, 'type')); $this->assertEquals('proposed', $this->model->getAttributeValue($sampleNodeString, 'alt')); $this->assertEquals(false, $this->model->getAttributeValue($sampleNodeString, 'dateFormatLength')); }
/** * Parses "eras" child of "dates" node and returns it's array representation. * * @param CldrModel $model CldrModel to read data from * @return array An array with localized literals for "eras" node */ protected function parseLocalizedEras(CldrModel $model) { $data = []; foreach ($model->getRawArray('dates/calendars/calendar[@type="gregorian"]/eras') as $widthType => $eras) { foreach ($eras as $eraNodeString => $eraValue) { $eraName = $model->getAttributeValue($eraNodeString, 'type'); $data[$widthType][$eraName] = $eraValue; } } return $data; }