@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | protected function checkExtensionLoaded() |
27 | 27 | { |
28 | - if (! extension_loaded('swoole')) { |
|
28 | + if (!extension_loaded('swoole')) { |
|
29 | 29 | throw new \RuntimeException('Extension swoole is required to use SwooleTableAdapter.'); |
30 | 30 | } |
31 | 31 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | $key = "{$service}-failures"; |
57 | 57 | |
58 | - if (! $this->table->exist($key)) { |
|
58 | + if (!$this->table->exist($key)) { |
|
59 | 59 | return false; |
60 | 60 | } |
61 | 61 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | { |
88 | 88 | $key = "{$service}-open"; |
89 | 89 | |
90 | - if (! $this->table->exists($key)) { |
|
90 | + if (!$this->table->exists($key)) { |
|
91 | 91 | return false; |
92 | 92 | } |
93 | 93 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | { |
105 | 105 | $key = "{$service}-half_open"; |
106 | 106 | |
107 | - if (! $this->table->exists($key)) { |
|
107 | + if (!$this->table->exists($key)) { |
|
108 | 108 | return false; |
109 | 109 | } |
110 | 110 |
@@ -18,11 +18,11 @@ |
||
18 | 18 | $circuit->setSettings([ |
19 | 19 | 'timeWindow' => 60, // Time for an open circuit (seconds) |
20 | 20 | 'failureRateThreshold' => 50, // Fail rate for open the circuit |
21 | - 'intervalToHalfOpen' => 30, // Half open time (seconds) |
|
21 | + 'intervalToHalfOpen' => 30, // Half open time (seconds) |
|
22 | 22 | ]); |
23 | 23 | |
24 | 24 | // Check circuit status for service |
25 | -if (! $circuit->isAvailable()) { |
|
25 | +if (!$circuit->isAvailable()) { |
|
26 | 26 | die('Circuit is not available!'); |
27 | 27 | } |
28 | 28 |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | |
31 | 31 | public function __invoke(callable $handler): \Closure |
32 | 32 | { |
33 | - return function (RequestInterface $request, array $options) use ($handler) { |
|
33 | + return function(RequestInterface $request, array $options) use ($handler) { |
|
34 | 34 | |
35 | - if (! $this->circuitBreaker->isAvailable()) { |
|
35 | + if (!$this->circuitBreaker->isAvailable()) { |
|
36 | 36 | throw new CircuitBreakerException( |
37 | 37 | sprintf('"%s" is not available', $this->circuitBreaker->getService()) |
38 | 38 | ); |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | $promise = $handler($request, $options); |
42 | 42 | |
43 | 43 | return $promise->then( |
44 | - function (ResponseInterface $response) { |
|
44 | + function(ResponseInterface $response) { |
|
45 | 45 | $this->executeCircuitBreakerOnResponse($response); |
46 | 46 | |
47 | 47 | return $response; |
48 | 48 | }, |
49 | - function (\Throwable $exception) { |
|
49 | + function(\Throwable $exception) { |
|
50 | 50 | $this->circuitBreaker->failure(); |
51 | 51 | throw $exception; |
52 | 52 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | return; |
63 | 63 | } |
64 | 64 | |
65 | - if (! $this->isStatusCodeRangeValid($statusCode)) { |
|
65 | + if (!$this->isStatusCodeRangeValid($statusCode)) { |
|
66 | 66 | $this->circuitBreaker->failure(); |
67 | 67 | return; |
68 | 68 | } |
@@ -18,11 +18,11 @@ |
||
18 | 18 | $circuit->setSettings([ |
19 | 19 | 'timeWindow' => 60, // Time for an open circuit (seconds) |
20 | 20 | 'failureRateThreshold' => 50, // Fail rate for open the circuit |
21 | - 'intervalToHalfOpen' => 30, // Half open time (seconds) |
|
21 | + 'intervalToHalfOpen' => 30, // Half open time (seconds) |
|
22 | 22 | ]); |
23 | 23 | |
24 | 24 | // Check circuit status for service |
25 | -if (! $circuit->isAvailable()) { |
|
25 | +if (!$circuit->isAvailable()) { |
|
26 | 26 | die('Circuit is not available!'); |
27 | 27 | } |
28 | 28 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | protected function checkExtensionLoaded() |
31 | 31 | { |
32 | - if (! extension_loaded('redis')) { |
|
32 | + if (!extension_loaded('redis')) { |
|
33 | 33 | throw new \RuntimeException('Extension redis is required to use RedisAdapter.'); |
34 | 34 | } |
35 | 35 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | $this->resetKeyIfInfiniteTTL($serviceName); |
83 | 83 | |
84 | - if (! $this->redis->get($serviceName)) { |
|
84 | + if (!$this->redis->get($serviceName)) { |
|
85 | 85 | $this->redis->multi(); |
86 | 86 | $this->redis->incr($serviceName); |
87 | 87 | $this->redis->expire($serviceName, $timeWindow); |
@@ -15,7 +15,7 @@ |
||
15 | 15 | |
16 | 16 | $this->resetKeyIfInfiniteTTL($serviceName); |
17 | 17 | |
18 | - if (! $this->redis->get($serviceName)) { |
|
18 | + if (!$this->redis->get($serviceName)) { |
|
19 | 19 | $this->redis->incr($serviceName); |
20 | 20 | return (bool) $this->redis->expire($serviceName, $timeWindow); |
21 | 21 | } |