| Conditions | 2 |
| Paths | 1 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | public function register() |
||
| 27 | { |
||
| 28 | $this->getContainer()->add('redis', function () { |
||
| 29 | $redisConfig = $this->getContainer()->get('config')['redis']; |
||
| 30 | |||
| 31 | $args = [ |
||
| 32 | 'host' => $redisConfig['host'], |
||
| 33 | 'port' => $redisConfig['port'], |
||
| 34 | 'database' => intval($redisConfig['db']), |
||
| 35 | 'scheme' => 'tcp', |
||
| 36 | ]; |
||
| 37 | |||
| 38 | if (! empty($redisConfig['pass'])) { |
||
| 39 | $args['password'] = $redisConfig['pass']; |
||
| 40 | } |
||
| 41 | |||
| 42 | $client = new Client($args); |
||
| 43 | |||
| 44 | return $client; |
||
| 45 | }); |
||
| 46 | |||
| 47 | $this->getContainer()->share('RedisUtility', function() { |
||
| 48 | return new RedisUtility(); |
||
| 49 | }); |
||
| 50 | } |
||
| 51 | } |
||
| 52 |