Expr::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 5
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 5
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
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\Branch;
13
use Zicht\Tool\Script\Node\Node;
14
15
/**
16
 * Represents an expression node in a script.
17
 */
18 View Code Duplication
class Expr extends Branch
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
{
20
    /**
21
     * Constructor.
22
     *
23
     * @param Node $node
24
     */
25 5
    public function __construct($node)
26
    {
27 5
        parent::__construct();
28 5
        $this->nodes[0] = $node;
29 5
    }
30
31
32
    /**
33
     * @{inheritDoc}
34
     */
35
    public function compile(Buffer $buffer)
36
    {
37
        $buffer->raw('$z->value(');
38
        $this->nodes[0]->compile($buffer);
39
        $buffer->raw(')');
40
    }
41
}
42