PluginProbe
Code Engine – PHP Snippets, AI Functions & Automation for WordPress / 0.5.1
Code Engine – PHP Snippets, AI Functions & Automation for WordPress v0.5.1
0.5.7 0.5.6 0.5.5 0.5.4 0.5.3 0.5.2 0.5.1 0.5.0 0.4.9 0.4.8 0.4.7 0.4.6 trunk 0.0.1 0.0.2 0.2.8 0.2.9 0.3.0 0.3.1 0.3.2 0.3.3 0.3.4 0.3.5 0.3.6 0.3.7 All 33 releases
code-engine / vendor / nikic / php-parser / lib / PhpParser / Node / Identifier.php

Identifier.php in Code Engine – PHP Snippets, AI Functions & Automation for WordPress 0.5.1, at vendor/nikic/php-parser/lib/PhpParser/Node/Identifier.php

76 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php declare(strict_types=1);
2
3 namespace PhpParser\Node;
4
5 use PhpParser\NodeAbstract;
6
7 /**
8 * Represents a non-namespaced name. Namespaced names are represented using Name nodes.
9 */
10 class Identifier extends NodeAbstract {
11 /** @var string Identifier as string */
12 public string $name;
13
14 /** @var array<string, bool> */
15 private static array $specialClassNames = [
16 'self' => true,
17 'parent' => true,
18 'static' => true,
19 ];
20
21 /**
22 * Constructs an identifier node.
23 *
24 * @param string $name Identifier as string
25 * @param array<string, mixed> $attributes Additional attributes
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 * Get identifier as string.
38 *
39 * @return string Identifier as string.
40 */
41 public function toString(): string {
42 return $this->name;
43 }
44
45 /**
46 * Get lowercased identifier as string.
47 *
48 * @return string Lowercased identifier as string
49 */
50 public function toLowerString(): string {
51 return strtolower($this->name);
52 }
53
54 /**
55 * Checks whether the identifier is a special class name (self, parent or static).
56 *
57 * @return bool Whether identifier is a special class name
58 */
59 public function isSpecialClassName(): bool {
60 return isset(self::$specialClassNames[strtolower($this->name)]);
61 }
62
63 /**
64 * Get identifier as string.
65 *
66 * @return string Identifier as string
67 */
68 public function __toString(): string {
69 return $this->name;
70 }
71
72 public function getType(): string {
73 return 'Identifier';
74 }
75 }
76