Lines
n/a
0 / 0
Functions and Methods
n/a
0 / 0
Classes and Traits
n/a
0 / 0
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Contracts; | |
| 6 | ||
| 7 | use Stewart\Contracts\Exception\StateException; | |
| 8 | use Stewart\Contracts\Exception\TimeException; | |
| 9 | use Stewart\Contracts\State\StateChange; | |
| 10 | use Stewart\Contracts\Time\Duration; | |
| 11 | ||
| 12 | /** @extends EventStream<StateChange> */ | |
| 13 | interface StateChangeStream extends EventStream | |
| 14 | { | |
| 15 | public function distinctUntilChanged(): static; | |
| 16 | ||
| 17 | public function startWithCurrentState(): static; | |
| 18 | ||
| 19 | /** | |
| 20 | * @param string|non-empty-list<string>|null $from | |
| 21 | * @throws StateException|TimeException | |
| 22 | */ | |
| 23 | public function whenChangedTo(string $state, ?Duration $for = null, string|array|null $from = null, bool $fromAnyState = false): static; | |
| 24 | ||
| 25 | /** @throws TimeException */ | |
| 26 | public function whenStableFor(Duration $window): static; | |
| 27 | ||
| 28 | /** @throws StateException|TimeException */ | |
| 29 | public function whenAbove(float $threshold, ?Duration $for = null, ?string $attribute = null, float $hysteresis = 0.0): static; | |
| 30 | ||
| 31 | /** @throws StateException|TimeException */ | |
| 32 | public function whenBelow(float $threshold, ?Duration $for = null, ?string $attribute = null, float $hysteresis = 0.0): static; | |
| 33 | ||
| 34 | /** @return EventStream<StateChange> */ | |
| 35 | public function acrossEntities(): EventStream; | |
| 36 | } |