Conditions | 4 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
20 | public function __construct() |
||
21 | { |
||
22 | if (!class_exists('Redis')) { |
||
23 | throw new Exception('Stats ERROR : Redis NOT supported.'); |
||
24 | } |
||
25 | $redis = new Redis(); |
||
26 | $redis->connect( |
||
27 | getenv('REDIS_HOST') ?: '127.0.0.1', |
||
28 | (int) getenv('REDIS_PORT') |
||
29 | ); |
||
30 | if (!$redis->isConnected()) { |
||
31 | throw new RuntimeException('Redis not connected'); |
||
32 | } |
||
33 | $this->redis = $redis; |
||
34 | } |
||
43 | } |