| 1 | <?php |
||
| 7 | class JsonSerializer extends Object implements IRestSerializer { |
||
|
|
|||
| 8 | |||
| 9 | /** |
||
| 10 | * @config |
||
| 11 | */ |
||
| 12 | private static $is_active = true; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * The content type. |
||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | private $contentType = "application/json"; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Serializes the given data into a json string. |
||
| 22 | * |
||
| 23 | * @param array $data the data that should be serialized |
||
| 24 | * @return string a json formatted string |
||
| 25 | */ |
||
| 26 | public function serialize($data) { |
||
| 29 | |||
| 30 | public function contentType() { |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Indicates if the serializer is active. |
||
| 36 | * Serializers can be deactivated to use another implementation for the same mime type. |
||
| 37 | * |
||
| 38 | * @return boolean |
||
| 39 | */ |
||
| 40 | public function active() { |
||
| 43 | } |
||
| 44 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.