The internal representation of CLDR uses array keys like:
'calendar[@type="gregorian"]'
This method helps to extract the node name from such keys.
public static getNodeName ( string $nodeString ) : string | ||
$nodeString | string | String with node name and optional attribute(s) |
return | string | Name of the node |
/** * @test */ public function returnsNodeNameCorrectly() { $sampleNodeString1 = 'calendar'; $sampleNodeString2 = 'calendar[@type="gregorian"]'; $this->assertEquals('calendar', $this->model->getNodeName($sampleNodeString1)); $this->assertEquals('calendar', $this->model->getNodeName($sampleNodeString2)); }