Total Complexity | 4 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
8 | final class Msgpack implements CacheInterface |
||
9 | { |
||
10 | /** |
||
11 | * @var CacheInterface |
||
12 | */ |
||
13 | private $cache; |
||
14 | |||
15 | /** |
||
16 | * @param CacheInterface $cache |
||
17 | */ |
||
18 | 3 | public function __construct(CacheInterface $cache) |
|
21 | 3 | } |
|
22 | |||
23 | /** |
||
24 | * @param string $key |
||
25 | * @return PromiseInterface |
||
26 | */ |
||
27 | public function get($key) |
||
28 | { |
||
29 | 1 | return $this->cache->get($key)->then(function ($result) { |
|
30 | 1 | return msgpack_unpack($result, true); |
|
|
|||
31 | 1 | }); |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param string $key |
||
36 | * @param mixed $value |
||
37 | * @return PromiseInterface |
||
38 | */ |
||
39 | 1 | public function set($key, $value) |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * @param string $key |
||
46 | * @return PromiseInterface |
||
47 | */ |
||
48 | 1 | public function remove($key) |
|
51 | } |
||
52 | } |
||
53 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.