Format.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2017 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  */
12 
15 
16 /**
17  * Format defines the interface for all format classes. Format instances
18  * are used to map external data representations like JSON, XML/SOAP or HTML
19  * to internal ones and vice versa. All data values are supposed to be scalar or
20  * array values except for wcmf::lib::model::Node instances, for which each external
21  * representation defines a special notation.
22  *
23  * @author ingo herwig <ingo@wemove.com>
24  */
25 interface Format {
26 
27  /**
28  * Get the MIME type of the format
29  * @return String
30  */
31  public function getMimeType();
32 
33  /**
34  * Deserialize Request data from the external representation into Nodes and scalars/arrays.
35  * @param $request The Request instance
36  */
37  public function deserialize(Request $request);
38 
39  /**
40  * Serialize Response data according to the external representation.
41  * @param $response The Response instance
42  */
43  public function serialize(Response $response);
44 
45  /**
46  * Check if the response identified by it's cache id is cached for this format.
47  * @param $response The Response instance
48  * @return Boolean
49  */
50  public function isCached(Response $response);
51 
52  /**
53  * Get the caching date, if the response is cached.
54  * @param $response The Response instance
55  * @return DateTime or null, if not cached
56  */
57  public function getCacheDate(Response $response);
58 
59  /**
60  * Get the response headers.
61  * @param $response The Response instance
62  * @return Associative array with header names and values
63  */
64  public function getResponseHeaders(Response $response);
65 }
66 ?>
Response holds the response values that are used as output from Controller instances.
Definition: Response.php:20
getResponseHeaders(Response $response)
Get the response headers.
getCacheDate(Response $response)
Get the caching date, if the response is cached.
serialize(Response $response)
Serialize Response data according to the external representation.
deserialize(Request $request)
Deserialize Request data from the external representation into Nodes and scalars/arrays.
isCached(Response $response)
Check if the response identified by it&#39;s cache id is cached for this format.
getMimeType()
Get the MIME type of the format.
Request holds the request values that are used as input to Controller instances.
Definition: Request.php:18
Format defines the interface for all format classes.
Definition: Format.php:25