Completed
Push — master ( 8cdbfc...fd3d59 )
by Christian
04:54 queued 02:01
created

createStatementResultSerializer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
/*
4
 * This file is part of the xAPI package.
5
 *
6
 * (c) Christian Flothmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Xabbuh\XApi\Serializer;
13
14
use Symfony\Component\Serializer\SerializerInterface;
15
use Xabbuh\XApi\Serializer\SerializerFactoryInterface;
16
17
/**
18
 * Creates serializer instances that use the Symfony Serializer component.
19
 *
20
 * @author Christian Flothmann <[email protected]>
21
 */
22
final class SerializerFactory implements SerializerFactoryInterface
23
{
24
    private $serializer;
25
26
    public function __construct(SerializerInterface $serializer = null)
27
    {
28
        $this->serializer = $serializer ?: Serializer::createSerializer();
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function createStatementSerializer()
35
    {
36
        return new StatementSerializer($this->serializer);
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function createStatementResultSerializer()
43
    {
44
        return new StatementResultSerializer($this->serializer);
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function createActorSerializer()
51
    {
52
        return new ActorSerializer($this->serializer);
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58
    public function createDocumentDataSerializer()
59
    {
60
        return new DocumentDataSerializer($this->serializer);
61
    }
62
}
63