Conditions | 1 |
Paths | 1 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
30 | public function info() |
||
31 | { |
||
32 | // Temporarily change the command use to get info as earlier and newer redis |
||
33 | // versions breaks it into sections. |
||
34 | $commandClass = $this->redis->getProfile()->getCommandClass('info'); |
||
35 | $this->redis->getProfile()->defineCommand('info', 'Predis\Command\ServerInfo'); |
||
36 | |||
37 | $info = $this->redis->info(); |
||
38 | |||
39 | $this->redis->getProfile()->defineCommand('info', $commandClass); |
||
40 | |||
41 | return $info; |
||
42 | } |
||
43 | } |
||
44 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: