| 1 | <?php |
||
| 22 | class StatementSerializer implements StatementSerializerInterface |
||
| 23 | { |
||
| 24 | /** |
||
| 25 | * @var SerializerInterface The underlying serializer |
||
| 26 | */ |
||
| 27 | private $serializer; |
||
| 28 | |||
| 29 | 1 | public function __construct(SerializerInterface $serializer) |
|
| 33 | |||
| 34 | /** |
||
| 35 | * {@inheritDoc} |
||
| 36 | */ |
||
| 37 | public function serializeStatement(Statement $statement) |
||
| 38 | { |
||
| 39 | return $this->serializer->serialize($statement, 'json'); |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * {@inheritDoc} |
||
| 44 | */ |
||
| 45 | public function serializeStatements(array $statements) |
||
| 49 | |||
| 50 | /** |
||
| 51 | * {@inheritDoc} |
||
| 52 | */ |
||
| 53 | public function deserializeStatement($data) |
||
| 54 | { |
||
| 55 | return $this->serializer->deserialize( |
||
| 56 | $data, |
||
| 57 | 'Xabbuh\XApi\Model\Statement', |
||
| 58 | 'json' |
||
| 59 | ); |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * {@inheritDoc} |
||
| 64 | */ |
||
| 65 | 1 | public function deserializeStatements($data) |
|
| 73 | } |
||
| 74 |