1: | <?php declare(strict_types=1); |
2: | |
3: | namespace PhpParser\Node; |
4: | |
5: | use PhpParser\NodeAbstract; |
6: | |
7: | |
8: | |
9: | |
10: | class Identifier extends NodeAbstract |
11: | { |
12: | |
13: | public $name; |
14: | |
15: | private static $specialClassNames = [ |
16: | 'self' => true, |
17: | 'parent' => true, |
18: | 'static' => true, |
19: | ]; |
20: | |
21: | |
22: | |
23: | |
24: | |
25: | |
26: | |
27: | public function __construct(string $name, array $attributes = []) { |
28: | $this->attributes = $attributes; |
29: | $this->name = $name; |
30: | } |
31: | |
32: | public function getSubNodeNames() : array { |
33: | return ['name']; |
34: | } |
35: | |
36: | |
37: | |
38: | |
39: | |
40: | |
41: | public function toString() : string { |
42: | return $this->name; |
43: | } |
44: | |
45: | |
46: | |
47: | |
48: | |
49: | |
50: | public function toLowerString() : string { |
51: | return strtolower($this->name); |
52: | } |
53: | |
54: | |
55: | |
56: | |
57: | |
58: | |
59: | public function isSpecialClassName() : bool { |
60: | return isset(self::$specialClassNames[strtolower($this->name)]); |
61: | } |
62: | |
63: | |
64: | |
65: | |
66: | |
67: | |
68: | public function __toString() : string { |
69: | return $this->name; |
70: | } |
71: | |
72: | public function getType() : string { |
73: | return 'Identifier'; |
74: | } |
75: | } |
76: | |