Passed
Push — trunk ( f99c1c...cd7f4f )
by Christian
13:22 queued 13s
created

RedisMultiWrapper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 31
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A __call() 0 6 1
A exec() 0 6 1
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Core\Test\Stub\Redis;
4
5
class RedisMultiWrapper
6
{
7
    /**
8
     * @param array<mixed> $results
9
     */
10
    public function __construct(private readonly \Redis $redis, private array $results = [])
11
    {
12
    }
13
14
    /**
15
     * @param array<mixed> $arguments
16
     *
17
     * @return RedisMultiWrapper
18
     */
19
    public function __call(string $name, array $arguments)
20
    {
21
        // @phpstan-ignore-next-line
22
        $this->results[] = $this->redis->$name(...$arguments);
23
24
        return $this;
25
    }
26
27
    /**
28
     * @return mixed[]
29
     */
30
    public function exec(): array
31
    {
32
        $ret = $this->results;
33
        $this->results = [];
34
35
        return $ret;
36
    }
37
}
38