@@ -36,7 +36,7 @@ |
||
| 36 | 36 | protected function resolveConnection($name = null) |
| 37 | 37 | { |
| 38 | 38 | $name = $name ?: 'default'; |
| 39 | - $options = Arr::get($this->config, 'options', [ ]); |
|
| 39 | + $options = Arr::get($this->config, 'options', []); |
|
| 40 | 40 | |
| 41 | 41 | if (isset($this->config[$name])) { |
| 42 | 42 | return $this->connector()->connect($this->config[$name], $options); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public static function normalizeConnection(array $connection) |
| 85 | 85 | { |
| 86 | - $normal = [ ]; |
|
| 86 | + $normal = []; |
|
| 87 | 87 | |
| 88 | 88 | if (array_key_exists('options', $connection)) { |
| 89 | 89 | $normal['options'] = $connection['options']; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | return static::normalizeHostString($host); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - return [ $host ]; |
|
| 120 | + return [$host]; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | protected static function normalizeHostArray(array $hostArray) |
| 134 | 134 | { |
| 135 | - if (! array_key_exists('host', $hostArray)) { |
|
| 136 | - return [ $hostArray ]; |
|
| 135 | + if (!array_key_exists('host', $hostArray)) { |
|
| 136 | + return [$hostArray]; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | $port = Arr::get($hostArray, 'port', 26379); |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | protected static function normalizeHostString($hostString, $port = 26379) |
| 157 | 157 | { |
| 158 | - $hosts = [ ]; |
|
| 158 | + $hosts = []; |
|
| 159 | 159 | |
| 160 | 160 | foreach (explode(',', $hostString) as $host) { |
| 161 | 161 | $host = trim($host); |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | if (Str::contains($host, ':')) { |
| 164 | 164 | $hosts[] = $host; |
| 165 | 165 | } else { |
| 166 | - $hosts[] = [ 'host' => $host, 'port' => $port ]; |
|
| 166 | + $hosts[] = ['host' => $host, 'port' => $port]; |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
@@ -44,11 +44,11 @@ |
||
| 44 | 44 | * @return PredisConnection The Sentinel connection containing a configured |
| 45 | 45 | * Predis Client |
| 46 | 46 | */ |
| 47 | - public function connect(array $server, array $options = [ ]) |
|
| 47 | + public function connect(array $server, array $options = []) |
|
| 48 | 48 | { |
| 49 | 49 | // Merge the global options shared by all Sentinel connections with |
| 50 | 50 | // connection-specific options |
| 51 | - $clientOpts = array_merge($options, Arr::pull($server, 'options', [ ])); |
|
| 51 | + $clientOpts = array_merge($options, Arr::pull($server, 'options', [])); |
|
| 52 | 52 | |
| 53 | 53 | // Automatically set "replication" to "sentinel". This is the Sentinel |
| 54 | 54 | // driver, after all. |
@@ -69,13 +69,13 @@ |
||
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * Register the core Redis Sentinel connection manager. |
|
| 74 | - * |
|
| 75 | - * @return void |
|
| 76 | - */ |
|
| 77 | - protected function registerServices() |
|
| 78 | - { |
|
| 72 | + /** |
|
| 73 | + * Register the core Redis Sentinel connection manager. |
|
| 74 | + * |
|
| 75 | + * @return void |
|
| 76 | + */ |
|
| 77 | + protected function registerServices() |
|
| 78 | + { |
|
| 79 | 79 | $this->app->singleton('redis-sentinel', function ($app) { |
| 80 | 80 | $class = $this->config->getVersionedRedisSentinelManagerClass(); |
| 81 | 81 | $config = $this->config->get('database.redis-sentinel', [ ]); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | $this->app->singleton('redis-sentinel', function ($app) { |
| 86 | 86 | $class = $this->config->getVersionedRedisSentinelManagerClass(); |
| 87 | - $config = $this->config->get('database.redis-sentinel', [ ]); |
|
| 87 | + $config = $this->config->get('database.redis-sentinel', []); |
|
| 88 | 88 | $driver = Arr::pull($config, 'client', 'predis'); |
| 89 | 89 | |
| 90 | 90 | return new RedisSentinelManager(new $class($driver, $config)); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | // This package's Horizon service provider will set up the queue |
| 129 | 129 | // connector a bit differently, so we don't need to do it twice: |
| 130 | - if (! $this->config->horizonAvailable) { |
|
| 130 | + if (!$this->config->horizonAvailable) { |
|
| 131 | 131 | $this->addRedisSentinelQueueConnector(); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | */ |
| 323 | 323 | protected function setSessionConfiguration() |
| 324 | 324 | { |
| 325 | - if (! $this->supportsSessions |
|
| 325 | + if (!$this->supportsSessions |
|
| 326 | 326 | || $this->config->get('session.driver') !== 'redis-sentinel' |
| 327 | 327 | || $this->config->get('session.connection') !== null |
| 328 | 328 | ) { |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | protected function mergePackageConfiguration() |
| 358 | 358 | { |
| 359 | 359 | $defaultConfig = require self::CONFIG_PATH; |
| 360 | - $currentConfig = $this->config->get('redis-sentinel', [ ]); |
|
| 360 | + $currentConfig = $this->config->get('redis-sentinel', []); |
|
| 361 | 361 | |
| 362 | 362 | $this->packageConfig = array_merge($defaultConfig, $currentConfig); |
| 363 | 363 | } |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | { |
| 373 | 373 | $connections = $this->config->get('database.redis-sentinel'); |
| 374 | 374 | |
| 375 | - if (! is_array($connections)) { |
|
| 375 | + if (!is_array($connections)) { |
|
| 376 | 376 | return; |
| 377 | 377 | } |
| 378 | 378 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | /** |
| 148 | 148 | * Create an instance of the loader and load the configuration in one step. |
| 149 | 149 | * |
| 150 | - * @param LaravelApplication|LumenApplication $app The current application |
|
| 150 | + * @param \Illuminate\Contracts\Container\Container $app The current application |
|
| 151 | 151 | * instance that provides context and services needed to load the |
| 152 | 152 | * appropriate configuration. |
| 153 | 153 | * |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * This helper method enables the package's service providers to set config |
| 230 | 230 | * values without having to resolve the config service from the container. |
| 231 | 231 | * |
| 232 | - * @param string|array $key The key of the value or a tree of values as |
|
| 232 | + * @param string $key The key of the value or a tree of values as |
|
| 233 | 233 | * an associative array. |
| 234 | 234 | * @param mixed $value The value to set for the specified key. |
| 235 | 235 | * |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @param Client $client The Redis client to wrap. |
| 45 | 45 | * @param array $sentinelOptions Sentinel-specific connection options. |
| 46 | 46 | */ |
| 47 | - public function __construct(Client $client, array $sentinelOptions = [ ]) |
|
| 47 | + public function __construct(Client $client, array $sentinelOptions = []) |
|
| 48 | 48 | { |
| 49 | 49 | parent::__construct($client); |
| 50 | 50 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | foreach ($sentinelOptions as $option => $value) { |
| 54 | 54 | DynamicMethod::parseFromUnderscore($option) |
| 55 | 55 | ->prepend('set') |
| 56 | - ->callOn($this, [ $value ]); |
|
| 56 | + ->callOn($this, [$value]); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Monospice\LaravelRedisSentinel\Horizon; |
| 4 | 4 | |
| 5 | -use Illuminate\Contracts\Config\Repository as ConfigRepository; |
|
| 6 | 5 | use Illuminate\Contracts\Container\Container; |
| 7 | 6 | use Illuminate\Contracts\Redis\Factory as RedisFactory; |
| 8 | 7 | use Illuminate\Support\Arr; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $this->createHorizonConnectionConfiguration(); |
| 65 | 65 | |
| 66 | 66 | $class = $this->config->getVersionedRedisSentinelManagerClass(); |
| 67 | - $config = $this->config->get('database.redis-sentinel', [ ]); |
|
| 67 | + $config = $this->config->get('database.redis-sentinel', []); |
|
| 68 | 68 | $driver = Arr::pull($config, 'client', 'predis'); |
| 69 | 69 | |
| 70 | 70 | return new RedisSentinelManager(new $class($driver, $config)); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | protected function createHorizonConnectionConfiguration() |
| 86 | 86 | { |
| 87 | 87 | $horizonConfig = $this->getSelectedConnectionConfiguration(); |
| 88 | - $options = Arr::get($horizonConfig, 'options', [ ]); |
|
| 88 | + $options = Arr::get($horizonConfig, 'options', []); |
|
| 89 | 89 | $options['prefix'] = $this->config->get('horizon.prefix', 'horizon:'); |
| 90 | 90 | |
| 91 | 91 | $horizonConfig['options'] = $options; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | // If we're already overriding Laravel's standard Redis API, we don't |
| 130 | 130 | // need to rebind the "redis" service for Horizon. |
| 131 | - return ! $this->config->shouldOverrideLaravelRedisApi |
|
| 131 | + return !$this->config->shouldOverrideLaravelRedisApi |
|
| 132 | 132 | && $this->config->get('horizon.driver') === 'redis-sentinel'; |
| 133 | 133 | } |
| 134 | 134 | |