Data::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
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
14
15
/**
16
 * Represents a raw data node inside a script
17
 */
18
class Data implements Node
19
{
20
    /**
21
     * Construct the node.
22
     *
23
     * @param string $data
24
     */
25
    public function __construct($data)
26
    {
27
        $this->data = $data;
0 ignored issues
show
Bug introduced by
The property data 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...
28
    }
29
30
31
    /**
32
     * @{inheritDoc}
33
     */
34
    public function compile(Buffer $buffer)
35
    {
36
        $buffer->asPhp($this->data);
37
    }
38
}
39