RedisCompatibility   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 11
c 2
b 0
f 0
dl 0
loc 57
rs 10
wmc 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 3 1
A sMembers() 0 3 1
A isConnected() 0 3 1
A multi() 0 3 1
A exists() 0 3 1
A del() 0 3 1
A set() 0 3 1
A ttl() 0 3 1
A connect() 0 10 1
A sAdd() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Core\Test\Stub\Redis;
4
5
if (version_compare(phpversion('redis') ?: '0.0.0', '6.0.0', '>=')) {
6
    trait RedisCompatibility
7
    {
8
        public function connect(
9
            string $host,
0 ignored issues
show
Unused Code introduced by
The parameter $host is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

9
            /** @scrutinizer ignore-unused */ string $host,

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
10
            int $port = 6379,
0 ignored issues
show
Unused Code introduced by
The parameter $port is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

10
            /** @scrutinizer ignore-unused */ int $port = 6379,

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
11
            float $timeout = 0,
0 ignored issues
show
Unused Code introduced by
The parameter $timeout is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

11
            /** @scrutinizer ignore-unused */ float $timeout = 0,

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
12
            ?string $persistent_id = null,
0 ignored issues
show
Unused Code introduced by
The parameter $persistent_id is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

12
            /** @scrutinizer ignore-unused */ ?string $persistent_id = null,

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
13
            int $retry_interval = 0,
0 ignored issues
show
Unused Code introduced by
The parameter $retry_interval is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

13
            /** @scrutinizer ignore-unused */ int $retry_interval = 0,

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
14
            float $read_timeout = 0,
0 ignored issues
show
Unused Code introduced by
The parameter $read_timeout is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

14
            /** @scrutinizer ignore-unused */ float $read_timeout = 0,

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
15
            ?array $context = null
0 ignored issues
show
Unused Code introduced by
The parameter $context is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

15
            /** @scrutinizer ignore-unused */ ?array $context = null

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
16
        ): bool {
17
            return true;
18
        }
19
20
        public function isConnected(): bool
21
        {
22
            return true;
23
        }
24
25
        public function get(string $key): mixed
26
        {
27
            return $this->doGet($key);
0 ignored issues
show
Bug introduced by
It seems like doGet() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
            return $this->/** @scrutinizer ignore-call */ doGet($key);
Loading history...
28
        }
29
30
        public function set(string $key, mixed $value, mixed $options = null): \Redis|string|bool
31
        {
32
            return $this->doSet($key, $value, $options);
0 ignored issues
show
Bug introduced by
It seems like doSet() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

32
            return $this->/** @scrutinizer ignore-call */ doSet($key, $value, $options);
Loading history...
33
        }
34
35
        public function del(array|string $key, string ...$other_keys): \Redis|int|false
36
        {
37
            return $this->doDel($key, ...$other_keys);
0 ignored issues
show
Bug introduced by
It seems like doDel() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

37
            return $this->/** @scrutinizer ignore-call */ doDel($key, ...$other_keys);
Loading history...
38
        }
39
40
        public function exists(mixed $key, mixed ...$other_keys): \Redis|int|bool
41
        {
42
            return $this->doExists($key, ...$other_keys);
0 ignored issues
show
Bug introduced by
It seems like doExists() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

42
            return $this->/** @scrutinizer ignore-call */ doExists($key, ...$other_keys);
Loading history...
43
        }
44
45
        public function sAdd(string $key, mixed $value, mixed ...$other_values): \Redis|int|false
46
        {
47
            return $this->doSAdd($key, $value, ...$other_values);
0 ignored issues
show
Bug introduced by
It seems like doSAdd() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

47
            return $this->/** @scrutinizer ignore-call */ doSAdd($key, $value, ...$other_values);
Loading history...
48
        }
49
50
        public function sMembers(string $key): \Redis|array|false
51
        {
52
            return $this->doSMembers($key);
0 ignored issues
show
Bug introduced by
It seems like doSMembers() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

52
            return $this->/** @scrutinizer ignore-call */ doSMembers($key);
Loading history...
53
        }
54
55
        public function ttl(string $key): \Redis|int|false
56
        {
57
            return $this->doTtl($key);
0 ignored issues
show
Bug introduced by
It seems like doTtl() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

57
            return $this->/** @scrutinizer ignore-call */ doTtl($key);
Loading history...
58
        }
59
60
        public function multi(int $value = \Redis::MULTI): \Redis|bool
0 ignored issues
show
Unused Code introduced by
The parameter $value is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

60
        public function multi(/** @scrutinizer ignore-unused */ int $value = \Redis::MULTI): \Redis|bool

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
61
        {
62
            return new RedisMultiWrapper($this);
0 ignored issues
show
Bug introduced by
$this of type Shopware\Core\Test\Stub\Redis\RedisCompatibility is incompatible with the type Redis expected by parameter $redis of Shopware\Core\Test\Stub\...iWrapper::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

62
            return new RedisMultiWrapper(/** @scrutinizer ignore-type */ $this);
Loading history...
63
        }
64
    }
65
} else {
66
    trait RedisCompatibility
67
    {
68
        public function connect(
69
            $host,
0 ignored issues
show
Unused Code introduced by
The parameter $host is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

69
            /** @scrutinizer ignore-unused */ $host,

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
70
            $port = 6379,
0 ignored issues
show
Unused Code introduced by
The parameter $port is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

70
            /** @scrutinizer ignore-unused */ $port = 6379,

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
71
            $timeout = 0,
0 ignored issues
show
Unused Code introduced by
The parameter $timeout is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

71
            /** @scrutinizer ignore-unused */ $timeout = 0,

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
72
            $persistent_id = null,
0 ignored issues
show
Unused Code introduced by
The parameter $persistent_id is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

72
            /** @scrutinizer ignore-unused */ $persistent_id = null,

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
73
            $retry_interval = 0,
0 ignored issues
show
Unused Code introduced by
The parameter $retry_interval is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

73
            /** @scrutinizer ignore-unused */ $retry_interval = 0,

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
74
            $read_timeout = 0,
0 ignored issues
show
Unused Code introduced by
The parameter $read_timeout is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

74
            /** @scrutinizer ignore-unused */ $read_timeout = 0,

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
75
            $context = null
0 ignored issues
show
Unused Code introduced by
The parameter $context is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

75
            /** @scrutinizer ignore-unused */ $context = null

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
76
        ) {
77
            return true;
78
        }
79
80
        public function isConnected()
81
        {
82
            return true;
83
        }
84
85
        public function get($key)
86
        {
87
            return $this->doGet($key);
88
        }
89
90
        public function set($key, $value, $options = 0)
91
        {
92
            return $this->doSet($key, $value, $options);
93
        }
94
95
        public function del($key1, ...$otherKeys)
96
        {
97
            return $this->doDel($key1, ...$otherKeys);
98
        }
99
100
        public function exists($key, ...$other_keys)
101
        {
102
            return $this->doExists($key, ...$other_keys);
103
        }
104
105
        public function sAdd($key, $value, ...$other_values)
106
        {
107
            return $this->doSAdd($key, $value, ...$other_values);
108
        }
109
110
        public function sMembers($key)
111
        {
112
            return $this->doSMembers($key);
113
        }
114
115
        public function ttl($key)
116
        {
117
            return $this->doTtl($key);
118
        }
119
120
        public function multi($mode = \Redis::MULTI)
0 ignored issues
show
Unused Code introduced by
The parameter $mode is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

120
        public function multi(/** @scrutinizer ignore-unused */ $mode = \Redis::MULTI)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
121
        {
122
            return new RedisMultiWrapper($this);
0 ignored issues
show
Bug introduced by
$this of type Shopware\Core\Test\Stub\Redis\RedisCompatibility is incompatible with the type Redis expected by parameter $redis of Shopware\Core\Test\Stub\...iWrapper::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

122
            return new RedisMultiWrapper(/** @scrutinizer ignore-type */ $this);
Loading history...
123
        }
124
    }
125
}
126