IgbinarySerializer::type()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
/*
4
 * This file is part of the Koded package.
5
 *
6
 * (c) Mihail Binev <[email protected]>
7
 *
8
 * Please view the LICENSE distributed with this source code
9
 * for the full copyright and license information.
10
 */
11
12
namespace Koded\Stdlib\Serializer;
13
14
use Koded\Stdlib\Serializer;
15
16
class IgbinarySerializer implements Serializer
17
{
18
    public function serialize(mixed $value): ?string
19
    {
20
        return \igbinary_serialize($value);
21
    }
22
23
    public function unserialize(string $value): mixed
24
    {
25
        return \igbinary_unserialize($value);
26
    }
27
28
    public function type(): string
29
    {
30
        return Serializer::IGBINARY;
31
    }
32
}
33