yvoyer /
php-state
| 1 | <?php declare(strict_types=1); |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 2 | |||
| 3 | namespace Star\Component\State\Callbacks; |
||
| 4 | |||
| 5 | use Star\Component\State\InvalidStateTransitionException; |
||
| 6 | use Star\Component\State\StateMachine; |
||
| 7 | |||
| 8 | final class AlwaysThrowExceptionOnFailure implements TransitionCallback |
||
|
0 ignored issues
–
show
|
|||
| 9 | { |
||
|
0 ignored issues
–
show
|
|||
| 10 | /** |
||
|
0 ignored issues
–
show
|
|||
| 11 | * @param mixed $context |
||
|
0 ignored issues
–
show
|
|||
| 12 | * @param StateMachine $machine |
||
|
0 ignored issues
–
show
|
|||
| 13 | */ |
||
|
0 ignored issues
–
show
|
|||
| 14 | 28 | public function beforeStateChange($context, StateMachine $machine): void |
|
|
0 ignored issues
–
show
|
|||
| 15 | { |
||
|
0 ignored issues
–
show
|
|||
| 16 | 28 | } |
|
|
0 ignored issues
–
show
|
|||
| 17 | |||
| 18 | /** |
||
|
0 ignored issues
–
show
|
|||
| 19 | * @param mixed $context |
||
|
0 ignored issues
–
show
|
|||
| 20 | * @param StateMachine $machine |
||
|
0 ignored issues
–
show
|
|||
| 21 | */ |
||
|
0 ignored issues
–
show
|
|||
| 22 | 19 | public function afterStateChange($context, StateMachine $machine): void |
|
| 23 | { |
||
|
0 ignored issues
–
show
|
|||
| 24 | 19 | } |
|
|
0 ignored issues
–
show
|
|||
| 25 | |||
| 26 | /** |
||
|
0 ignored issues
–
show
|
|||
| 27 | * @param InvalidStateTransitionException $exception |
||
|
0 ignored issues
–
show
|
|||
| 28 | * @param mixed $context |
||
|
0 ignored issues
–
show
|
|||
| 29 | * @param StateMachine $machine |
||
|
0 ignored issues
–
show
|
|||
| 30 | * |
||
| 31 | * @return string |
||
|
0 ignored issues
–
show
|
|||
| 32 | * @throws InvalidStateTransitionException |
||
|
0 ignored issues
–
show
|
|||
| 33 | */ |
||
| 34 | 9 | public function onFailure(InvalidStateTransitionException $exception, $context, StateMachine $machine): string |
|
| 35 | { |
||
|
0 ignored issues
–
show
|
|||
| 36 | 9 | throw $exception; |
|
| 37 | } |
||
|
0 ignored issues
–
show
|
|||
| 38 | } |
||
|
0 ignored issues
–
show
|
|||
| 39 |