JsonSerializationDefinition   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 6
dl 0
loc 29
ccs 4
cts 5
cp 0.8
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createConfigurator() 0 4 1
A formalize() 0 6 1
1
<?php
2
namespace PSB\Core\Serialization\Json;
3
4
5
use PSB\Core\Serialization\SerializationConfigurator;
6
use PSB\Core\Serialization\SerializationDefinition;
7
use PSB\Core\Util\Settings;
8
9
class JsonSerializationDefinition extends SerializationDefinition
10
{
11
12
    /**
13
     * Creates the SerializationConfigurator specific to the serialization implementation.
14
     *
15
     * @param Settings $settings
16
     *
17
     * @return SerializationConfigurator
18
     */
19 1
    public function createConfigurator(Settings $settings)
20
    {
21 1
        return new JsonSerializationConfigurator($settings);
22
    }
23
24
    /**
25
     * Provides a factory method for building a message serializer
26
     *
27
     * @param Settings $settings
28
     *
29
     * @return callable
30
     */
31 1
    public function formalize(Settings $settings)
32
    {
33
        return function () {
34
            return new JsonMessageSerializer(new JsonSerializer(new ObjectNormalizer(), new JsonEncoder()));
35 1
        };
36
    }
37
}
38