NodeSerializer.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2020 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of the MIT License.
7  *
8  * See the LICENSE file distributed with this work for
9  * additional information.
10  */
11 namespace wcmf\lib\model;
12 
14 
15 /**
16  * NodeSerializer implementations are used to serialize Nodes into an
17  * array representation or deserialize an array representation into Nodes.
18  *
19  * @author ingo herwig <ingo@wemove.com>
20  */
21 interface NodeSerializer {
22 
23  /**
24  * Check if the given data represent a serialized Node
25  * @param $data A variable of any type
26  * @return Boolean
27  */
28  public function isSerializedNode($data);
29 
30  /**
31  * Deserialize a Node from serialized data. Only values given in data are being set.
32  * @param $data An array containing the serialized Node data
33  * @param $parent The parent Node (default: _null_)
34  * @param $role The role of the serialized Node in relation to parent (default: _null_)
35  * @return An array with keys 'node' and 'data' where the node
36  * value is the Node instance and the data value is the
37  * remaining part of data, that is not used for deserializing the Node
38  */
39  public function deserializeNode($data, Node $parent=null, $role=null);
40 
41  /**
42  * Serialize a Node into an array
43  * @param $node The Node instance to serialize
44  * @return Associative array
45  */
46  public function serializeNode($node);
47 }
48 ?>
NodeSerializer implementations are used to serialize Nodes into an array representation or deserializ...
serializeNode($node)
Serialize a Node into an array.
isSerializedNode($data)
Check if the given data represent a serialized Node.
Node adds the concept of relations to PersistentObject.
Definition: Node.php:34
deserializeNode($data, Node $parent=null, $role=null)
Deserialize a Node from serialized data.
Node related interfaces and classes.
Definition: namespaces.php:26