Conditions | 3 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
75 | 3 | public function getClient(): Redis |
|
76 | { |
||
77 | 3 | if (is_null($this->instance)) { |
|
78 | try { |
||
79 | 3 | $this->instance = new Redis(); |
|
80 | 3 | @$this->instance->connect($this->host, $this->port); |
|
|
|||
81 | 2 | } catch (\RedisException $e) { |
|
82 | 2 | $this->error = true; |
|
83 | 2 | $this->errorMessage = $e->getMessage(); |
|
84 | 2 | $this->errorCode = 1; |
|
85 | } |
||
86 | } |
||
87 | 3 | return $this->instance; |
|
88 | } |
||
134 |
If you suppress an error, we recommend checking for the error condition explicitly: