@@ -272,7 +272,8 @@ |
||
| 272 | 272 | { |
| 273 | 273 | return Promise::doReject(new WriteException('Cache object is not open.')); |
| 274 | 274 | } |
| 275 | - if ($ttl <= 0) { |
|
| 275 | + if ($ttl <= 0) |
|
| 276 | + { |
|
| 276 | 277 | return Promise::doReject(new WriteException('TTL needs to be higher than 0.')); |
| 277 | 278 | } |
| 278 | 279 | if (!array_key_exists($key, $this->storage)) |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | if ($this->paused) |
| 168 | 168 | { |
| 169 | 169 | $this->paused = false; |
| 170 | - $this->loopTimer = $this->getLoop()->addPeriodicTimer($this->config['interval'], [ $this, 'handleTick' ]); |
|
| 170 | + $this->loopTimer = $this->getLoop()->addPeriodicTimer($this->config['interval'], [$this, 'handleTick']); |
|
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | $timer = round($ttl / $this->config['interval']); |
| 266 | - $this->timers[$key] = [ 'timeout' => $timer, 'ttl' => $ttl ]; |
|
| 266 | + $this->timers[$key] = ['timeout' => $timer, 'ttl' => $ttl]; |
|
| 267 | 267 | $this->timersCounter++; |
| 268 | 268 | return Promise::doResolve($ttl); |
| 269 | 269 | } |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | */ |
| 376 | 376 | protected function createConfig($config = []) |
| 377 | 377 | { |
| 378 | - return array_merge([ 'interval' => 1e-1 ], $config); |
|
| 378 | + return array_merge(['interval' => 1e-1], $config); |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | /** |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | protected function handleStart() |
| 395 | 395 | { |
| 396 | 396 | $this->resume(); |
| 397 | - $this->emit('start', [ $this ]); |
|
| 397 | + $this->emit('start', [$this]); |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | /** |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | $this->timersCounter = 0; |
| 408 | 408 | |
| 409 | 409 | $this->pause(); |
| 410 | - $this->emit('stop', [ $this ]); |
|
| 410 | + $this->emit('stop', [$this]); |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | /** |