Completed
Branch master (6bd7ca)
by Eugene
01:33
created

BinTransformer::pack()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
/*
4
 * This file is part of the rybakit/msgpack.php package.
5
 *
6
 * (c) Eugene Leonovich <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace MessagePack\TypeTransformer;
13
14
use MessagePack\Packer;
15
use MessagePack\Type\Bin;
16
17
class BinTransformer implements CanPack
18
{
19 2
    public function pack(Packer $packer, $value) : ?string
20
    {
21 2
        return $value instanceof Bin
22 1
            ? $packer->packBin($value->data)
23 2
            : null;
24
    }
25
}
26