Lines
80.00%
4 / 5
Functions and Methods
80.00%
4 / 5
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| CancelledSubscription | 80.00% | 4 / 5 | 80.00% | 4 / 5 | 5.20 | 0.00% | 0 / 1 | |||
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| createUnique | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| unsubscribe | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| isActive | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| getId | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Support\Stream; | |
| 6 | ||
| 7 | use Stewart\Contracts\Subscription; | |
| 8 | ||
| 9 | /** @internal */ | |
| 10 | final readonly class CancelledSubscription implements Subscription | |
| 11 | { | |
| 12 | private function __construct(private string $id) {} | |
| 13 | ||
| 14 | public static function createUnique(): self | |
| 15 | { | |
| 16 | return new self('cancelled:' . bin2hex(random_bytes(8))); | |
| 17 | } | |
| 18 | ||
| 19 | public function unsubscribe(): void {} | |
| 20 | ||
| 21 | public function isActive(): bool | |
| 22 | { | |
| 23 | return false; | |
| 24 | } | |
| 25 | ||
| 26 | public function getId(): string | |
| 27 | { | |
| 28 | return $this->id; | |
| 29 | } | |
| 30 | } |