Completed
Push — master ( a15a3c...decc90 )
by
unknown
04:44
created

MsgpackSerializer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 28
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 4 1
A getSupportedFormats() 0 4 1
A getDefaultFormat() 0 4 1
1
<?php
2
3
namespace MediaMonks\RestApiBundle\Serializer;
4
5
use MediaMonks\RestApiBundle\Request\Format;
6
7
class MsgpackSerializer extends AbstractSerializer implements SerializerInterface
8
{
9
    /**
10
     * @param $data
11
     * @param $format
12
     * @return mixed|string
13
     */
14 1
    public function serialize($data, $format)
15
    {
16 1
        return msgpack_pack($data);
17
    }
18
19
    /**
20
     * @return array
21
     */
22 2
    public function getSupportedFormats()
23
    {
24 2
        return [Format::FORMAT_MSGPACK];
25
    }
26
27
    /**
28
     * @return string
29
     */
30 1
    public function getDefaultFormat()
31
    {
32 1
        return Format::FORMAT_MSGPACK;
33
    }
34
}
35