<?php declare(strict_types=1);/** * gb media * All Rights Reserved. * * Unauthorized copying of this file, via any medium is strictly prohibited. * The content of this file is proprietary and confidential. * * @category Shopware * @package Shopware_Plugins * @subpackage GbmedForm * @copyright Copyright (c) 2020, gb media * @license proprietary * @author Giuseppe Bottino * @link http://www.gb-media.biz */namespace Gbmed\Form\Framework\Struct;use Shopware\Core\Framework\Struct\Struct;class GbmedFormStruct extends Struct implements \ArrayAccess{ /** * @var array */ protected $data; public function __construct(array $data = []) { $this->data = $data; } public function has(string $property): bool { return \array_key_exists($property, $this->data); } public function offsetExists($offset) { return \array_key_exists($offset, $this->data); } public function offsetGet($offset) { return $this->data[$offset] ?? null; } public function offsetSet($offset, $value): void { $this->data[$offset] = $value; } public function offsetUnset($offset): void { unset($this->data[$offset]); } public function get(string $key) { return $this->offsetGet($key); } public function set($key, $value) { return $this->data[$key] = $value; } public function assign(array $options) { $this->data = array_replace_recursive($this->data, $options); return $this; } public function all() { return $this->data; } public function jsonSerialize(): array { $data = parent::jsonSerialize(); unset($data['data']); foreach ($this->data as $property => $value) { if ($value instanceof \DateTimeInterface) { $value = $value->format(\DateTime::ATOM); } $data[$property] = $value; } return $data; } public function getApiAlias(): string { return 'array_struct'; }}