ArrayAppend   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A createCommandWithArguments() 0 6 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 ArrayAppend extends CommandAbstract implements CommandInterface
11
{
12
    protected static $command = 'JSON.ARRAPPEND';
13
14
    private function __construct(
15
        string $key,
16
        Path $path,
17
        array $jsons
18
    ) {
19
        $this->arguments = array_merge([$key, $path->getPath()], $jsons);
20
    }
21
22
    public static function createCommandWithArguments(string $key, string $path, array $jsons) : CommandInterface
23
    {
24
        return new self(
25
            $key,
26
            new Path($path),
27
            array_map('json_encode', $jsons)
28
        );
29
    }
30
}
31