StorageRequest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
1
<?php
2
3
namespace seregazhuk\React\Memcached\Protocol\Request;
4
5
use seregazhuk\React\Memcached\Protocol\Parser;
6
7
final class StorageRequest extends Request
8
{
9
    /**
10
     * @param string $command
11
     * @param string $key
12
     * @param mixed $value
13
     * @param int $flags
14
     * @param int $expiration
15
     */
16
    public function __construct($command, $key, $value, $flags = 0, $expiration = 0)
17
    {
18
        // Serialize non-numeric values. Numeric values should stay as they are
19
        // because they could be incremented/decremented.
20
        $value = is_numeric($value) ? $value : serialize($value);
21
        
22
        $command = implode(' ', [$command, $key, $flags, $expiration, strlen($value)]);
23
24
        $this->command = $command . Parser::COMMAND_SEPARATOR . $value . Parser::COMMAND_SEPARATOR;
25
    }
26
}
27