bakaphp /
phalcon-api
| 1 | <?php |
||||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||||
| 2 | |||||
| 3 | namespace Gewaer\Providers; |
||||
| 4 | |||||
| 5 | use Phalcon\Di\ServiceProviderInterface; |
||||
| 6 | use Phalcon\DiInterface; |
||||
| 7 | use Redis; |
||||
| 8 | use function Gewaer\Core\envValue; |
||||
| 9 | |||||
| 10 | class RedisProvider implements ServiceProviderInterface |
||||
| 11 | {
|
||||
| 12 | /** |
||||
| 13 | * @param DiInterface $container |
||||
| 14 | */ |
||||
| 15 | public function register(DiInterface $container) |
||||
| 16 | {
|
||||
| 17 | $config = $container->getShared('config');
|
||||
| 18 | |||||
| 19 | $container->setShared( |
||||
| 20 | 'redis', |
||||
| 21 | function () use ($config) {
|
||||
| 22 | //Connect to redis |
||||
| 23 | //for now redis normal |
||||
| 24 | $redis = new Redis(); |
||||
| 25 | $redis->connect(envValue('REDIS_HOST', '127.0.0.1'), envValue('REDIS_PORT', '6379'));
|
||||
|
0 ignored issues
–
show
envValue('REDIS_PORT', '6379') of type string|boolean is incompatible with the type integer expected by parameter $port of Redis::connect().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 26 | $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP); |
||||
| 27 | return $redis; |
||||
| 28 | } |
||||
| 29 | ); |
||||
| 30 | } |
||||
| 31 | } |
||||
| 32 |