1 | <?php |
||
23 | class PhpRedisConnector extends LaravelPhpRedisConnector |
||
24 | { |
||
25 | /** |
||
26 | * Holds the current sentinel servers. |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $servers; |
||
31 | |||
32 | /** |
||
33 | * The number of times the client attempts to retry a command when it fails |
||
34 | * to connect to a Redis instance behind Sentinel. |
||
35 | * |
||
36 | * @var int |
||
37 | */ |
||
38 | protected $connectorRetryLimit = 20; |
||
39 | |||
40 | /** |
||
41 | * The time in milliseconds to wait before the client retries a failed |
||
42 | * command. |
||
43 | * |
||
44 | * @var int |
||
45 | */ |
||
46 | protected $connectorRetryWait = 1000; |
||
47 | |||
48 | /** |
||
49 | * Configuration options specific to Sentinel connection operation |
||
50 | * |
||
51 | * Some of the Sentinel configuration options can be entered in this class. |
||
52 | * The retry_wait and retry_limit values are passed to the connection. |
||
53 | * |
||
54 | * @var array |
||
55 | */ |
||
56 | protected $sentinelKeys = [ |
||
57 | 'sentinel_timeout' => null, |
||
58 | 'retry_wait' => null, |
||
59 | 'retry_limit' => null, |
||
60 | 'update_sentinels' => null, |
||
61 | |||
62 | 'sentinel_persistent' => null, |
||
63 | 'sentinel_read_timeout' => null, |
||
64 | ]; |
||
65 | |||
66 | /** |
||
67 | * Instantiate the connector and check if the required extension is available. |
||
68 | */ |
||
69 | public function __construct() |
||
79 | |||
80 | /** |
||
81 | * Create a new Redis Sentinel connection from the provided configuration |
||
82 | * options |
||
83 | * |
||
84 | * @param array $server The client configuration for the connection |
||
|
|||
85 | * @param array $options The global client options shared by all Sentinel |
||
86 | * connections |
||
87 | * |
||
88 | * @return PhpRedisConnection The Sentinel connection containing a configured |
||
89 | * PhpRedis Client |
||
90 | */ |
||
91 | public function connect(array $servers, array $options = [ ]) |
||
132 | |||
133 | /** |
||
134 | * Create the Redis client instance |
||
135 | * |
||
136 | * @param array $options |
||
137 | * @return Redis |
||
138 | * |
||
139 | * @throws LogicException |
||
140 | */ |
||
141 | protected function createClientWithSentinel(array $options) |
||
191 | |||
192 | /** |
||
193 | * Update the list With sentinel servers. |
||
194 | * |
||
195 | * @param RedisSentinel $sentinel |
||
196 | * @param string $currentHost |
||
197 | * @param int $currentPort |
||
198 | * @param string $service |
||
199 | * @return void |
||
200 | */ |
||
201 | protected function updateSentinels(RedisSentinel $sentinel, string $currentHost, int $currentPort, string $service) |
||
217 | |||
218 | /** |
||
219 | * Format a server. |
||
220 | * |
||
221 | * @param mixed $server |
||
222 | * @return array |
||
223 | * |
||
224 | * @throws RedisException |
||
225 | */ |
||
226 | protected function formatServer($server) |
||
243 | |||
244 | /** |
||
245 | * Retry the callback when a RedisException is catched. |
||
246 | * |
||
247 | * @param callable $callback The operation to execute. |
||
248 | * @param int $retryLimit The number of times the retry is performed. |
||
249 | * @param int $retryWait The time in milliseconds to wait before retrying again. |
||
250 | * @param callable $failureCallback The operation to execute when a failure happens. |
||
251 | * @return mixed The result of the first successful attempt. |
||
252 | * |
||
253 | * @throws RedisRetryException After exhausting the allowed number of |
||
254 | * attempts to connect. |
||
255 | */ |
||
256 | public static function retryOnFailure(callable $callback, int $retryLimit, int $retryWait, callable $failureCallback = null) |
||
279 | } |
||
280 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.
Consider the following example. The parameter
$ireland
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was changed, but the annotation was not.