Call   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 23.53%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 32
ccs 4
cts 17
cp 0.2353
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A compile() 0 15 3
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
namespace Zicht\Tool\Script\Node\Expr;
9
10
use Zicht\Tool\Script\Buffer;
11
use Zicht\Tool\Script\Node\Branch;
12
use Zicht\Tool\Script\Node\Node;
13
14
/**
15
 * Represents a function call node
16
 */
17
class Call extends Branch
18
{
19
    /**
20
     * Constructor
21
     *
22
     * @param Node $function
23
     */
24 4
    public function __construct($function)
25
    {
26 4
        parent::__construct();
27 4
        $this->nodes[] = $function;
28 4
    }
29
30
    /**
31
     * @{inheritDoc}
32
     */
33
    public function compile(Buffer $buffer)
34
    {
35
        $buffer->raw('$z->call(');
36
        foreach ($this->nodes as $i => $n) {
37
            if ($i == 0) {
38
                $n->compile($buffer);
39
            } else {
40
                $buffer->raw(', ');
41
                $buffer->raw('$z->value(');
42
                $n->compile($buffer);
43
                $buffer->raw(')');
44
            }
45
        }
46
        $buffer->raw(')');
47
    }
48
}
49