for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
/**
* It's free open-source software released under the MIT License.
*
* @author Anatoly Fenric <[email protected]>
* @copyright Copyright (c) 2021, Anatoly Fenric
* @license https://github.com/sunrise-php/hydrator/blob/master/LICENSE
* @link https://github.com/sunrise-php/hydrator
*/
namespace Sunrise\Hydrator;
* Import classes
use ArrayAccess;
use JsonSerializable;
* Import functions
use function array_key_exists;
* Json
class Json implements ArrayAccess, JsonSerializable
{
protected array $data;
* Constructor of the class
public function __construct(array $data)
$this->data = $data;
}
* {@inheritdoc}
public function offsetExists($offset) : bool
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 jsonSerialize() : array
return $this->data;