1 | <?php |
||
15 | class ScriptCreator |
||
16 | { |
||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $script = ''; |
||
21 | |||
22 | /** |
||
23 | * @var Opcodes |
||
24 | */ |
||
25 | private $opcodes; |
||
26 | |||
27 | /** |
||
28 | * @var Math |
||
29 | */ |
||
30 | private $math; |
||
31 | |||
32 | /** |
||
33 | * @param Math $math |
||
34 | * @param Opcodes $opcodes |
||
35 | * @param Buffer|null $buffer |
||
36 | */ |
||
37 | 1125 | public function __construct(Math $math, Opcodes $opcodes, Buffer $buffer = null) |
|
46 | |||
47 | /** |
||
48 | * Add an opcode to the script |
||
49 | * |
||
50 | * @param string $name |
||
51 | * @return $this |
||
52 | */ |
||
53 | 297 | public function op($name) |
|
59 | |||
60 | /** |
||
61 | * Push data into the stack. |
||
62 | * |
||
63 | * @param $data |
||
64 | * @return $this |
||
65 | * @throws \Exception |
||
66 | */ |
||
67 | 375 | public function push(Buffer $data) |
|
97 | |||
98 | /** |
||
99 | * @param int $n |
||
100 | * @return $this |
||
101 | */ |
||
102 | public function int($n) |
||
114 | |||
115 | /** |
||
116 | * @param Serializable $object |
||
117 | * @return $this |
||
118 | */ |
||
119 | public function pushSerializable(Serializable $object) |
||
124 | |||
125 | /** |
||
126 | * @param Serializable[] $serializable |
||
127 | * @return $this |
||
128 | */ |
||
129 | public function pushSerializableArray(array $serializable) |
||
137 | |||
138 | /** |
||
139 | * @param ScriptInterface $script |
||
140 | * @return $this |
||
141 | */ |
||
142 | 6 | public function concat(ScriptInterface $script) |
|
147 | |||
148 | /** |
||
149 | * @return ScriptInterface |
||
150 | */ |
||
151 | 1119 | public function getScript() |
|
155 | } |
||
156 |