36 lines
804 B
PHP
36 lines
804 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
/**
|
|
* This file is part of Hyperf.
|
|
*
|
|
* @link https://www.hyperf.io
|
|
* @document https://hyperf.wiki
|
|
* @contact group@hyperf.io
|
|
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
|
*/
|
|
|
|
namespace Hyperf\Contract;
|
|
|
|
use ArrayObject;
|
|
|
|
interface NormalizerInterface
|
|
{
|
|
/**
|
|
* Normalizes an object into a set of arrays/scalars.
|
|
*
|
|
* @param mixed $object
|
|
* @return null|array|ArrayObject|bool|float|int|string
|
|
*/
|
|
public function normalize($object);
|
|
|
|
/**
|
|
* Denormalizes data back into an object of the given class.
|
|
*
|
|
* @param mixed $data Data to restore
|
|
* @param string $class The expected class to instantiate
|
|
* @return mixed|object
|
|
*/
|
|
public function denormalize($data, string $class);
|
|
}
|