Lines
0.00%
0 / 6
Functions and Methods
0.00%
0 / 2
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ConnectionStatus | 0.00% | 0 / 6 | 0.00% | 0 / 2 | 6 | 0.00% | 0 / 1 | |||
| markLost | 0.00% | 0 / 3 | 0.00% | 0 / 1 | 2 | |||||
| markRestored | 0.00% | 0 / 3 | 0.00% | 0 / 1 | 2 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Runtime\Worker; | |
| 6 | ||
| 7 | final class ConnectionStatus | |
| 8 | { | |
| 9 | public private(set) bool $connected = true; | |
| 10 | ||
| 11 | public function markLost(): bool | |
| 12 | { | |
| 13 | $changed = $this->connected; | |
| 14 | $this->connected = false; | |
| 15 | ||
| 16 | return $changed; | |
| 17 | } | |
| 18 | ||
| 19 | public function markRestored(): bool | |
| 20 | { | |
| 21 | $changed = !$this->connected; | |
| 22 | $this->connected = true; | |
| 23 | ||
| 24 | return $changed; | |
| 25 | } | |
| 26 | } |