Total Complexity | 5 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
10 | final class Get extends CommandAbstract implements CommandInterface |
||
11 | { |
||
12 | protected static $command = 'JSON.GET'; |
||
13 | |||
14 | private function __construct( |
||
15 | string $key, |
||
16 | array $paths |
||
17 | ) { |
||
18 | $paths = array_map(function (Path $path) { |
||
19 | return $path->getPath(); |
||
20 | }, $paths); |
||
21 | $this->arguments = [$key]; |
||
22 | $this->arguments = array_merge($this->arguments, $paths); |
||
23 | $this->responseCallback = function ($result) { |
||
24 | if ($result) { |
||
25 | return json_decode($result); |
||
26 | } |
||
27 | return null; |
||
28 | }; |
||
29 | } |
||
30 | |||
31 | public static function createCommandWithArguments(string $key, $paths = '.') : CommandInterface |
||
44 | ); |
||
45 | } |
||
47 |