Total Complexity | 5 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | final class Set extends CommandAbstract implements CommandInterface |
||
13 | { |
||
14 | protected static $command = 'JSON.SET'; |
||
15 | private static $validExistentialModifiers = ['NX', 'XX']; |
||
16 | |||
17 | private function __construct( |
||
18 | string $key, |
||
19 | Path $path, |
||
20 | string $json |
||
21 | ) { |
||
22 | $this->arguments = [$key, $path->getPath(), $json]; |
||
23 | } |
||
24 | |||
25 | public function withExistentialModifier(string $existentialModifier) : CommandInterface |
||
26 | { |
||
27 | if (!in_array($existentialModifier, self::$validExistentialModifiers, true)) { |
||
28 | throw new InvalidExistentialModifierException( |
||
29 | sprintf('Invalid existential modifier (%s) used for the command JSON.SET', $existentialModifier) |
||
30 | ); |
||
31 | } |
||
32 | $this->arguments[] = $existentialModifier; |
||
33 | return $this; |
||
34 | } |
||
35 | |||
36 | public static function createCommandWithArguments( |
||
51 | } |
||
52 | } |
||
53 |