NumberIncrementBy   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createCommandWithArguments() 0 7 1
A __construct() 0 8 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Redislabs\Module\ReJSON\Command;
5
6
use Redislabs\Interfaces\CommandInterface;
7
use Redislabs\Command\CommandAbstract;
8
use Redislabs\Module\ReJSON\Path;
9
10
final class NumberIncrementBy extends CommandAbstract implements CommandInterface
11
{
12
    protected static $command = 'JSON.NUMINCRBY';
13
14
    private function __construct(
15
        string $key,
16
        Path $path,
17
        int $incrementBy
18
    ) {
19
        $this->arguments = [$key, $path->getPath(), $incrementBy];
20
        $this->responseCallback = function ($result) {
21
            return json_decode($result);
22
        };
23
    }
24
25
    public static function createCommandWithArguments(string $key, string $path, int $incrementBy) : CommandInterface
26
    {
27
28
        return new self(
29
            $key,
30
            new Path($path),
31
            $incrementBy
32
        );
33
    }
34
}
35