Code Duplication    Length = 28-35 lines in 3 locations

src/ActorSerializer.php 1 location

@@ 23-50 (lines=28) @@
20
 *
21
 * @author Christian Flothmann <[email protected]>
22
 */
23
final class ActorSerializer implements ActorSerializerInterface
24
{
25
    /**
26
     * @var SerializerInterface
27
     */
28
    private $serializer;
29
30
    public function __construct(SerializerInterface $serializer)
31
    {
32
        $this->serializer = $serializer;
33
    }
34
35
    /**
36
     * {@inheritDoc}
37
     */
38
    public function serializeActor(Actor $actor)
39
    {
40
        return $this->serializer->serialize($actor, 'json');
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     */
46
    public function deserializeActor($data)
47
    {
48
        return $this->serializer->deserialize($data, 'Xabbuh\XApi\Model\Actor', 'json');
49
    }
50
}
51

src/DocumentDataSerializer.php 1 location

@@ 23-50 (lines=28) @@
20
 *
21
 * @author Christian Flothmann <[email protected]>
22
 */
23
final class DocumentDataSerializer implements DocumentDataSerializerInterface
24
{
25
    /**
26
     * @var SerializerInterface
27
     */
28
    private $serializer;
29
30
    public function __construct(SerializerInterface $serializer)
31
    {
32
        $this->serializer = $serializer;
33
    }
34
35
    /**
36
     * {@inheritDoc}
37
     */
38
    public function serializeDocumentData(DocumentData $data)
39
    {
40
        return $this->serializer->serialize($data, 'json');
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     */
46
    public function deserializeDocumentData($data)
47
    {
48
        return $this->serializer->deserialize($data, 'Xabbuh\XApi\Model\DocumentData', 'json');
49
    }
50
}
51

src/StatementResultSerializer.php 1 location

@@ 23-57 (lines=35) @@
20
 *
21
 * @author Christian Flothmann <[email protected]>
22
 */
23
final class StatementResultSerializer implements StatementResultSerializerInterface
24
{
25
    /**
26
     * @var SerializerInterface The underlying serializer
27
     */
28
    private $serializer;
29
30
    public function __construct(SerializerInterface $serializer)
31
    {
32
        $this->serializer = $serializer;
33
    }
34
35
    /**
36
     * {@inheritDoc}
37
     */
38
    public function serializeStatementResult(StatementResult $statementResult)
39
    {
40
        return $this->serializer->serialize($statementResult, 'json');
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     */
46
    public function deserializeStatementResult($data, array $attachments = array())
47
    {
48
        return $this->serializer->deserialize(
49
            $data,
50
            'Xabbuh\XApi\Model\StatementResult',
51
            'json',
52
            array(
53
                'xapi_attachments' => $attachments,
54
            )
55
        );
56
    }
57
}
58