1 | <?php |
||
9 | class SerializerFactory { |
||
10 | private static $lookup = [ |
||
11 | 'json' => 'application/json', |
||
12 | 'html' => 'text/html', |
||
13 | 'xml' => 'application/xml', |
||
14 | 'yaml' => 'application/yaml' |
||
15 | ]; |
||
16 | |||
17 | /** |
||
18 | * Returns a new instance of a serializer depending on the given type. |
||
19 | * |
||
20 | * @param string $mimeType the serializer type; Default: application/json |
||
21 | * @return IRestSerializer an instance of a serializer |
||
22 | * @throws RestUserException |
||
23 | */ |
||
24 | public static function create($mimeType='application/json') { |
||
35 | |||
36 | /** |
||
37 | * Determines the correct serializer from an incoming request. |
||
38 | * |
||
39 | * @param \SS_HTTPRequest $request the request object |
||
40 | * @return IRestSerializer a new instance of a serializer which fits the request best |
||
41 | * @throws RestUserException |
||
42 | */ |
||
43 | public static function create_from_request($request) { |
||
59 | } |
||
60 |