MsgpackSerializer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 17
ccs 2
cts 2
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSupportedFormats() 0 3 1
A getDefaultFormat() 0 3 1
A serialize() 0 3 1
1
<?php
2
3
namespace MediaMonks\RestApi\Serializer;
4
5
use MediaMonks\RestApi\Request\Format;
6
7
class MsgpackSerializer implements SerializerInterface
8
{
9
    use SerializerTrait;
10
11
    public function serialize($data, $format): string
12
    {
13
        return msgpack_pack($data);
14
    }
15
16 1
    public function getSupportedFormats(): array
17
    {
18 1
        return [Format::FORMAT_MSGPACK];
19
    }
20
21
    public function getDefaultFormat(): string
22
    {
23
        return Format::FORMAT_MSGPACK;
24 2
    }
25
}
26