Expr   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 44.44%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 3
dl 24
loc 24
ccs 4
cts 9
cp 0.4444
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1
A compile() 6 6 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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