Chris@13: true, Chris@13: 'parent' => true, Chris@13: 'static' => true, Chris@13: ]; Chris@13: Chris@13: /** Chris@13: * Constructs an identifier node. Chris@13: * Chris@13: * @param string $name Identifier as string Chris@13: * @param array $attributes Additional attributes Chris@13: */ Chris@13: public function __construct(string $name, array $attributes = []) { Chris@13: parent::__construct($attributes); Chris@13: $this->name = $name; Chris@13: } Chris@13: Chris@13: public function getSubNodeNames() : array { Chris@13: return ['name']; Chris@13: } Chris@13: Chris@13: /** Chris@13: * Get identifier as string. Chris@13: * Chris@13: * @return string Identifier as string. Chris@13: */ Chris@13: public function toString() : string { Chris@13: return $this->name; Chris@13: } Chris@13: Chris@13: /** Chris@13: * Get lowercased identifier as string. Chris@13: * Chris@13: * @return string Lowercased identifier as string Chris@13: */ Chris@13: public function toLowerString() : string { Chris@13: return strtolower($this->name); Chris@13: } Chris@13: Chris@13: /** Chris@13: * Checks whether the identifier is a special class name (self, parent or static). Chris@13: * Chris@13: * @return bool Whether identifier is a special class name Chris@13: */ Chris@13: public function isSpecialClassName() : bool { Chris@13: return isset(self::$specialClassNames[strtolower($this->name)]); Chris@13: } Chris@13: Chris@13: /** Chris@13: * Get identifier as string. Chris@13: * Chris@13: * @return string Identifier as string Chris@13: */ Chris@13: public function __toString() : string { Chris@13: return $this->name; Chris@13: } Chris@13: Chris@13: public function getType() : string { Chris@13: return 'Identifier'; Chris@13: } Chris@13: }