$this->getType(), '_' => [ 'variable' => Utilities::toArray($this->Variable) ] ]; } /** * Returns * * @return bool|float|int|InstructionInterface|string|null * @noinspection PhpMissingReturnTypeInspection */ public function getVariable() { return $this->Variable; } /** * @param bool|float|int|InstructionInterface|string|null $variable * @throws UnsupportedVariableType */ public function setVariable($variable): void { switch(Utilities::determineType($variable)) { default: $this->Variable = $variable; } } /** * Constructs a new GetVariable instruction from an array representation * * @throws UnsupportedVariableType */ public static function fromArray(array $data): InstructionInterface { $instruction = new GetVariable(); $instruction->setVariable($data['variable'] ?? null); return $instruction; } /** * @inheritDoc */ public function eval(Engine $engine) { return $engine->getEnvironment()->getRuntimeVariable( $engine->eval($this->Variable) ); } }