@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function __construct(string $prefix, int $threshold, int $duration) |
| 77 | 77 | { |
| 78 | - $this->failurePrefix = $prefix . 'failcount'; |
|
| 79 | - $this->openPrefix = $prefix . 'open'; |
|
| 78 | + $this->failurePrefix = $prefix.'failcount'; |
|
| 79 | + $this->openPrefix = $prefix.'open'; |
|
| 80 | 80 | $this->duration = $duration; |
| 81 | 81 | $this->threshold = $threshold; |
| 82 | 82 | } |
@@ -115,27 +115,27 @@ discard block |
||
| 115 | 115 | public function reportFailure(string $service): void |
| 116 | 116 | { |
| 117 | 117 | $currentCount = $this->getStorage()->get( |
| 118 | - $this->failurePrefix . $service |
|
| 118 | + $this->failurePrefix.$service |
|
| 119 | 119 | ); |
| 120 | 120 | |
| 121 | - $newTotal = ((int)$currentCount) + 1; |
|
| 121 | + $newTotal = ((int) $currentCount) + 1; |
|
| 122 | 122 | |
| 123 | 123 | if (!(bool) $currentCount) { |
| 124 | 124 | $this->getStorage()->set( |
| 125 | - $this->failurePrefix . $service, |
|
| 125 | + $this->failurePrefix.$service, |
|
| 126 | 126 | 1, |
| 127 | 127 | $this->duration |
| 128 | 128 | ); |
| 129 | 129 | } else { |
| 130 | 130 | $this->getStorage()->set( |
| 131 | - $this->failurePrefix . $service, |
|
| 131 | + $this->failurePrefix.$service, |
|
| 132 | 132 | $newTotal |
| 133 | 133 | ); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if ($newTotal >= $this->threshold) { |
| 137 | 137 | $this->getStorage()->set( |
| 138 | - $this->openPrefix . $service, |
|
| 138 | + $this->openPrefix.$service, |
|
| 139 | 139 | 1, |
| 140 | 140 | $this->duration |
| 141 | 141 | ); |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | { |
| 156 | 156 | try { |
| 157 | 157 | return (bool) $this->getStorage()->get( |
| 158 | - $this->openPrefix . $service, |
|
| 158 | + $this->openPrefix.$service, |
|
| 159 | 159 | false |
| 160 | 160 | ); |
| 161 | 161 | } catch (\Exception $e) { |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require __DIR__ . '/../../vendor/autoload.php'; |
|
| 3 | +require __DIR__.'/../../vendor/autoload.php'; |
|
| 4 | 4 | |
| 5 | 5 | use \liamsorsby\Hystrix\Storage\StorageFactory; |
| 6 | 6 | |