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

MsgpackSerializer::serialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 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