• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mkorkmaz / redislabs-rejson / 43

pending completion
43

push

travis-ci-com

mkorkmaz
fix: code style

2 of 2 new or added lines in 1 file covered. (100.0%)

236 of 252 relevant lines covered (93.65%)

21.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/src/RedisJson/Command/StringAppend.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Redislabs\Module\RedisJson\Command;
6

7
use Redislabs\Interfaces\CommandInterface;
8
use Redislabs\Command\CommandAbstract;
9
use Redislabs\Module\RedisJson\Path;
10
use Redislabs\Module\RedisJson\RedisJson;
11

12
final class StringAppend extends CommandAbstract implements CommandInterface
13
{
14
    protected static $command = 'JSON.STRAPPEND';
15

16
    private function __construct(
17
        string $key,
18
        Path $path,
19
        string $json
20
    ) {
21
        $this->arguments = [$key, $path->getPath(), $json];
9✔
22
        $this->responseCallback = static function ($result) use ($path) {
9✔
23
            if (!empty($result)) {
9✔
24
                if ($path->isLegacyPath() === false && (is_countable($result) ? count($result) : 0) === 1) {
9✔
25
                    return $result[0];
6✔
26
                }
27
                if ($path->isLegacyPath() === false && (is_countable($result) ? count($result) : 0) > 1) {
3✔
28
                    return $result;
×
29
                }
30
                return $result;
3✔
31
            }
32
            return null;
×
33
        };
34
    }
35

36
    public static function createCommandWithArguments(string $key, string $path, $json): CommandInterface
37
    {
38
        return new self(
9✔
39
            $key,
40
            new Path($path),
9✔
41
            json_encode($json, JSON_THROW_ON_ERROR)
9✔
42
        );
43
    }
44
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc