json; } /** * Add data. * * @param string $path Path used for storage * @param mixed $value Data to add * @param bool $overwrite Should overwrite existing data * * @return void * * @since 1.0.0 */ public function add(string $path, $value, bool $overwrite = true) : void { $this->json = ArrayUtils::setArray($path, $this->json, $value, '/', $overwrite); } /** * Remove data. * * @param string $path Path to the element to delete * * @return void * * @since 1.0.0 */ public function remove(string $path) : void { $this->json = ArrayUtils::unsetArray($path, $this->json, '/'); } /** * {@inheritdoc} */ public function serialize() : string { return (string) \json_encode($this->json); } /** * {@inheritdoc} */ public function unserialize($serialized) { $this->json = \json_decode($serialized, true); } /** * {@inheritdoc} */ public function jsonSerialize() { return $this->getJson(); } }