ArrayIndex   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createCommandWithArguments() 0 13 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 ArrayIndex extends CommandAbstract implements CommandInterface
11
{
12
    protected static $command = 'JSON.ARRINDEX';
13
14
    private function __construct(
15
        string $key,
16
        Path $path,
17
        string $json,
18
        int $start,
19
        int $stop
20
    ) {
21
        $this->arguments = [$key, $path->getPath(), $json, $start, $stop];
22
    }
23
24
    public static function createCommandWithArguments(
25
        string $key,
26
        string $path,
27
        $json,
28
        int $start,
29
        int $stop
30
    ) : CommandInterface {
31
        return new self(
32
            $key,
33
            new Path($path),
34
            json_encode($json),
35
            $start,
36
            $stop
37
        );
38
    }
39
}
40