1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
<?php
/**
* Copyright (c) 2016 Bernardo van der Wal
* MIT License
*
* Refer to the LICENSE file for the full copyright notice.
*/
namespace OneOfZero\Json\Converters;
use OneOfZero\Json\Nodes\MemberNode;
use OneOfZero\Json\Exceptions\ResumeSerializationException;
interface MemberConverterInterface
{
/**
* Should return a representation of the member value in the provided member node.
*
* The $typeHint argument may be null if the type could not be detected or inferred.
*
* The return value should be a type or structure that is serializable by json_encode().
*
* @param MemberNode $node
* @param string|null $typeHint
*
* @return mixed
*
* @throws ResumeSerializationException May be thrown to indicate that the serializer should resume with the regular
* serialization strategy. This can be useful to avoid recursion.
*/
public function serialize(MemberNode $node, $typeHint = null);
/**
* Should return a deserialized representation of the serialized value in the provided member node.
*
* The $typeHint argument may be null if the type could not be detected or inferred.
*
* @param MemberNode $node
* @param string|null $typeHint
*
* @return mixed
*
* @throws ResumeSerializationException May be thrown to indicate that the serializer should resume with the regular
* deserialization strategy. This can be useful to avoid recursion.
*/
public function deserialize(MemberNode $node, $typeHint = null);
}