Variable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 30
rs 10
c 0
b 0
f 0
ccs 3
cts 6
cp 0.5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A compile() 0 4 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