StatsResponse   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A parse() 0 15 3
1
<?php
2
3
namespace seregazhuk\React\Memcached\Protocol\Response;
4
5
use seregazhuk\React\Memcached\Protocol\Parser;
6
7
class StatsResponse extends Response
8
{
9
    /**
10
     * {@inheritdoc}
11
     */
12
    public function parse()
13
    {
14
        $lines = explode(Parser::COMMAND_SEPARATOR, $this->data);
15
        $stats = [];
16
17
        foreach ($lines as $line) {
18
            preg_match('/STAT (\w+) (\w+)/', $line, $matches);
19
            if (empty($matches)) {
20
                break;
21
            }
22
23
            $stats[$matches[1]] = $matches[2];
24
        }
25
26
        return $stats;
27
    }
28
}
29