Completed
Push — master ( 4ce755...511437 )
by Vitaly
02:11
created

CodeTrait::defLine()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 6
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php declare(strict_types = 1);
2
/**
3
 * Created by Vitaly Iegorov <[email protected]>.
4
 * on 04.09.16 at 10:13
5
 */
6
namespace samsonphp\generator;
7
8
/**
9
 * Trait for generators that can generate internal code.
10
 *
11
 * @author Vitaly Egorov <[email protected]>
12
 */
13
trait CodeTrait
14
{
15
    /** @var array Collection of code lines */
16
    protected $code = [];
17
18
    /**
19
     * Add function code line.
20
     *
21
     * @param string $code Code line
22
     *
23
     * @return $this
24
     */
25
    public function defLine(string $code)
26
    {
27
        $this->code[] = $code;
28
29
        return $this;
30
    }
31
}
32