Code Duplication    Length = 28-32 lines in 3 locations

src/ActorSerializer.php 1 location

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

src/DocumentDataSerializer.php 1 location

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

src/StatementResultSerializer.php 1 location

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