1 | <?php |
||
19 | class Opcode implements OpcodeInterface |
||
20 | { |
||
21 | /** |
||
22 | * @var array|string[]|null |
||
23 | */ |
||
24 | protected static $opcodes; |
||
25 | |||
26 | /** |
||
27 | * @var int |
||
28 | */ |
||
29 | protected $operation; |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $operands; |
||
35 | |||
36 | /** |
||
37 | * Opcode constructor. |
||
38 | * @param int $operation |
||
39 | * @param mixed ...$operands |
||
40 | */ |
||
41 | public function __construct(int $operation, ...$operands) |
||
46 | |||
47 | /** |
||
48 | * @return int |
||
49 | */ |
||
50 | public function getOperation(): int |
||
54 | |||
55 | /** |
||
56 | * @return array |
||
57 | */ |
||
58 | public function getOperands(): array |
||
62 | |||
63 | /** |
||
64 | * @param int $id |
||
65 | * @param Readable $readable |
||
66 | * @param int $offset |
||
67 | * @return JoinableOpcode |
||
68 | */ |
||
69 | public function join(int $id, Readable $readable, int $offset = 0): JoinableOpcode |
||
73 | |||
74 | /** |
||
75 | * @param mixed $value |
||
76 | * @return string |
||
77 | */ |
||
78 | protected function operandToString($value): string |
||
113 | |||
114 | /** |
||
115 | * @return string |
||
116 | */ |
||
117 | public function __toString(): string |
||
125 | |||
126 | /** |
||
127 | * @return string |
||
128 | */ |
||
129 | public function getName(): string |
||
133 | |||
134 | /** |
||
135 | * @param int $operation |
||
136 | * @return string |
||
137 | */ |
||
138 | public static function getOperationName(int $operation): string |
||
155 | } |
||
156 |