1 | <?php |
||
14 | class Code |
||
15 | { |
||
16 | /** |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $code = []; |
||
20 | |||
21 | /** |
||
22 | * @param string $statement |
||
23 | * @return Code |
||
24 | */ |
||
25 | 14 | public static function fromString($statement) |
|
32 | |||
33 | /** |
||
34 | * @param string $statement |
||
35 | */ |
||
36 | 33 | public function addStatement($statement) |
|
40 | |||
41 | /** |
||
42 | * @param string[] $statements |
||
43 | */ |
||
44 | 1 | public function addStatements($statements) |
|
45 | { |
||
46 | 1 | $this->code = array_merge($this->code, $statements); |
|
47 | 1 | } |
|
48 | |||
49 | /** |
||
50 | * @return string |
||
51 | */ |
||
52 | 33 | public function getCode() |
|
56 | |||
57 | /** |
||
58 | * @param string $file |
||
59 | * @return null |
||
60 | */ |
||
61 | 22 | public function writeTo($file) |
|
74 | |||
75 | /** |
||
76 | * @return string |
||
77 | */ |
||
78 | 27 | public function getCodeExecutable() |
|
119 | } |
||
120 |