Variable::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * For licensing information, please see the LICENSE file accompanied with this file.
4
 *
5
 * @author Gerard van Helden <[email protected]>
6
 * @copyright 2012 Gerard van Helden <http://melp.nl>
7
 */
8
9
namespace Zicht\Tool\Script\Node\Expr;
10
11
use Zicht\Tool\Script\Buffer;
12
use Zicht\Tool\Script\Node\Node;
13
use Zicht\Tool\Util;
14
15
/**
16
 * A variable node refers a variable in the container context.
17
 */
18
class Variable implements Node
19
{
20
    /**
21
     * @var array
22
     */
23
    protected $name;
24
25
26
    /**
27
     * Constructor.
28
     *
29
     * @param array $name
30
     */
31 9
    public function __construct($name)
32
    {
33 9
        $this->name = $name;
34 9
    }
35
36
37
    /**
38
     * Compiles the variable reference into the buffer.
39
     *
40
     * @param \Zicht\Tool\Script\Buffer $buffer
41
     * @return mixed|void
42
     */
43
    public function compile(Buffer $buffer)
44
    {
45
        $buffer->raw('$z->resolve(' . Util::toPhp($this->name) . ', true)');
46
    }
47
}
48