JsonSerializer::serialize()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace TreeHouse\Queue\Message\Serializer;
4
5
class JsonSerializer implements SerializerInterface
6
{
7
    /**
8
     * @inheritdoc
9
     */
10 10
    public function serialize($value)
11
    {
12 10
        if (!is_string($value)) {
13 9
            $value = json_encode($value);
14
        }
15
16 10
        return $value;
17
    }
18
}
19