YAMLResponseParser   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 4
dl 0
loc 17
ccs 6
cts 6
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A extractData() 0 11 2
1
<?php
2
3
4
namespace Beanie\Command\ResponseParser;
5
6
7
use Beanie\Exception\Exception;
8
use Beanie\Server\Server;
9
use Symfony\Component\Yaml\Exception\ParseException;
10
use Symfony\Component\Yaml\Yaml;
11
12
class YAMLResponseParser extends AbstractDataResponseParser
13
{
14
    /**
15
     * @inheritDoc
16
     */
17 2
    protected function extractData($responseLine, Server $server)
18
    {
19 2
        list(, $dataLength) = explode(' ', $responseLine);
20 2
        $rawData = $server->readData($dataLength);
21
22
        try {
23 2
            return Yaml::parse($rawData);
24 1
        } catch (ParseException $exception) {
25 1
            throw Exception::wrap($exception);
26
        }
27
    }
28
}
29