1: <?php
2: namespace Pharborist\Variables;
3:
4: use Pharborist\Functions\LexicalVariableNode;
5: use Pharborist\TokenNode;
6:
7: /**
8: * A basic variable.
9: *
10: * For example, $a
11: */
12: class VariableNode extends TokenNode implements VariableExpressionNode, LexicalVariableNode {
13: /**
14: * @return string
15: * The variable name, without the leading $.
16: */
17: public function getName() {
18: return ltrim($this->getText(), '$');
19: }
20:
21: /**
22: * @param string $name
23: * The name of the parameter, with or without the leading $.
24: *
25: * @return $this
26: */
27: public function setName($name) {
28: return $this->setText('$' . ltrim($name, '$'));
29: }
30: }
31: