Formatter.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  */
12 
15 
16 /**
17  * Formatter is the single entry point for request/response formatting.
18  * It chooses the configured formatter based on the format property of the request
19  * by getting the value XXXFormat from the configuration section 'formats'.
20  *
21  * @author ingo herwig <ingo@wemove.com>
22  */
23 interface Formatter {
24 
25  /**
26  * Get a Format instance from it's name.
27  * @param $name The format name
28  * @return Format
29  */
30  public function getFormat($name);
31 
32  /**
33  * Get the format name for the given mime type.
34  * @param $mimeType The mime type
35  * @return String
36  */
37  public function getFormatFromMimeType($mimeType);
38 
39  /**
40  * Deserialize Request data into objects.
41  * @param $request The Request instance
42  */
43  public function deserialize(Request $request);
44 
45  /**
46  * Serialize Response according to the output format.
47  * @param $response The Response instance
48  */
49  public function serialize(Response $response);
50 }
51 ?>
Response holds the response values that are used as output from Controller instances.
Definition: Response.php:20
Request holds the request values that are used as input to Controller instances.
Definition: Request.php:18
Formatter is the single entry point for request/response formatting.
Definition: Formatter.php:23
getFormatFromMimeType($mimeType)
Get the format name for the given mime type.
serialize(Response $response)
Serialize Response according to the output format.
deserialize(Request $request)
Deserialize Request data into objects.
getFormat($name)
Get a Format instance from it's name.