Completed
Push — master ( 58d973...681a3d )
by
unknown
05:43
created

MsgpackSerializer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

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
    public function serialize($data, $format)
15
    {
16
        return msgpack_pack($data);
17
    }
18
19
    /**
20
     * @return array
21
     */
22
    public function getSupportedFormats()
23
    {
24
        return [Format::FORMAT_MSGPACK];
25
    }
26
27
    /**
28
     * @return string
29
     */
30
    public function getDefaultFormat()
31
    {
32
        return Format::FORMAT_MSGPACK;
33
    }
34
}
35