Total Complexity | 3 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
9 | abstract class AbstractSerializer implements Serializer |
||
10 | { |
||
11 | private $serializer; |
||
12 | |||
13 | 7 | public function __construct(JMSSerializer $serializer) |
|
14 | { |
||
15 | 7 | $this->serializer = $serializer; |
|
16 | 7 | } |
|
17 | |||
18 | /** |
||
19 | * Serialize the document to a format. |
||
20 | * |
||
21 | * @param object $document |
||
22 | * |
||
23 | * @return string |
||
24 | */ |
||
25 | 2 | public function serialize(object $document): string |
|
30 | ); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * Deserialize the document to a PHP object of the given class. |
||
35 | * |
||
36 | * @param string $document |
||
37 | * @param string $className |
||
38 | * |
||
39 | * @return object |
||
40 | */ |
||
41 | 3 | public function deserialize(string $document, string $className): object |
|
47 | ); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * Return the supported format by the serializer. |
||
52 | * |
||
53 | * @return string |
||
54 | */ |
||
55 | abstract public function getSupportedFormat(): string; |
||
56 | } |
||
57 |