BinaryDataParser   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 11
ccs 4
cts 4
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A parse() 0 5 1
1
<?php
2
/**
3
 * This file is part of graze/unicontroller-client.
4
 *
5
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/unicontroller-client/blob/master/LICENSE.md
11
 * @link https://github.com/graze/unicontroller-client
12
 */
13
namespace Graze\UnicontrollerClient\Parser;
14
15
use Graze\UnicontrollerClient\Parser\Parser\ParserInterface;
16
17
class BinaryDataParser
18
{
19
    /**
20
     * @param string $string
21
     * @return string
22
     */
23 3
    public function parse($string)
24
    {
25 3
        list(, $length, $binaryData) = explode(',', $string, 3);
26 3
        $binaryData = substr($binaryData, 0, -10); // remove 'BinaryEnd,'
27 3
        return trim($binaryData, "\r\n");
28
    }
29
}
30