Identifier::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace PeacefulBit\Slate\Parser\Nodes;
4
5
use PeacefulBit\Slate\Core\Evaluator;
6
use PeacefulBit\Slate\Core\Frame;
7
8
class Identifier extends Node
9
{
10
    /**
11
     * @var string
12
     */
13
    private $name;
14
15
    /**
16
     * @param $name
17
     */
18
    public function __construct(string $name)
19
    {
20
        $this->name = $name;
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    public function getName()
27
    {
28
        return $this->name;
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    public function __toString()
35
    {
36
        return $this->getName();
37
    }
38
39
    /**
40
     * @param Frame $frame
41
     * @return mixed|null
42
     */
43
    public function evaluate(Frame $frame)
44
    {
45
        return $frame->get($this->getName());
46
    }
47
}
48