Unary   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A compile() 0 5 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\Op;
10
11
use Zicht\Tool\Script\Node\Branch;
12
use Zicht\Tool\Script\Node\Node;
13
use Zicht\Tool\Script\Buffer;
14
15
/**
16
 * Represents a unary expression
17
 */
18
class Unary extends Branch
19
{
20
    /**
21
     * Constructor.
22
     *
23
     * @param string $operator
24
     * @param Node $subject
25
     */
26
    public function __construct($operator, $subject)
27
    {
28
        parent::__construct();
29
        $this->operator = $operator;
0 ignored issues
show
Bug introduced by
The property operator does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
30
        $this->nodes[0] = $subject;
31
    }
32
33
34
    /**
35
     * @{inheritDoc}
36
     */
37
    public function compile(Buffer $buffer)
38
    {
39
        $buffer->raw($this->operator);
40
        $this->nodes[0]->compile($buffer);
41
    }
42
}
43