getAttributeValue() публичный статический Метод

An internal representation of CLDR data used by this class is a simple multi dimensional array where keys are nodes' names. If node has attributes, they are all stored as one string (e.g. 'calendar[@type="gregorian"]' or 'calendar[@type="gregorian"][@alt="proposed-x1001"'). This convenient method extracts a value of desired attribute by its name (in example above, in order to get the value 'gregorian', 'type' should be passed as the second parameter to this method). Note: this method does not validate the input!
public static getAttributeValue ( string $nodeString, string $attributeName ) : mixed
$nodeString string A node key to parse
$attributeName string Name of the attribute to find
Результат mixed Value of desired attribute, or FALSE if there is no such attribute
 /**
  * @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;
 }