properties)) { return $this->data[$name]; } throw new \Error("Cannot access property {$name} it dos not exists"); } /** * Has ordered an item data. * * @return void */ public function __construct( Order $order, SellItem $sellItem, string $firstname, string $lastname, string $address, ?string $address2, string $city, string $postcode, ?string $phone ) { $this->data = [ 'operation' => \intval(env('BOUTIQUE_ARCADIA_OP_CODE', 16)), 'support_code' => $sellItem->arcadia_id, 'label_type_support' => $sellItem->name, 'order_date' => $order->created_at, 'order_num' => $order->getKey(), 'state_order' => $order->payementType->equals(OrderType::cb) ? ArcadiaOrderType::cb->value() : ArcadiaOrderType::check->value(), 'package_unit_weight' => $sellItem->arcadia_weight, 'email' => $order->email, 'firstname' => $firstname, 'lastname' => $lastname, 'address' => $address, 'address2' => $address2, 'city' => $city, 'postcode' => $postcode, 'phone' => $phone, ]; } /** * Convert the object to its JSON representation. * * @param int $options * * @phpcs:disable Squiz.Commenting.FunctionComment.ScalarTypeHintMissing */ public function toJson($options = 0): string { // phpcs:enable return \json_encode($this->toArray(), $options); } /** * Get the instance as an array. */ public function toArray(): array { return $this->data; } }