| 1 | <?php |
||
| 9 | class HtmlSerializer extends \ViewableData implements IRestSerializer { |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @config |
||
| 13 | */ |
||
| 14 | private static $is_active = true; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * The content type |
||
| 18 | * @var string |
||
| 19 | */ |
||
| 20 | private $contentType = "text/html"; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * The given data will be serialized into an html string using a Silverstripe template. |
||
| 24 | * |
||
| 25 | * @param array $data |
||
| 26 | * @return string an html string |
||
|
|
|||
| 27 | */ |
||
| 28 | public function serialize($data) { |
||
| 32 | |||
| 33 | public function contentType() { |
||
| 36 | |||
| 37 | private function recursive($data, $level) { |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Indicates if the serializer is active. |
||
| 54 | * Serializers can be deactivated to use another implementation for the same mime type. |
||
| 55 | * |
||
| 56 | * @return boolean |
||
| 57 | */ |
||
| 58 | public function active() { |
||
| 61 | } |
||
| 62 |
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.