| 1 | <?php |
||
| 15 | abstract class AbstractWorkflow implements WorkflowInterface |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var Transition[] |
||
| 19 | */ |
||
| 20 | protected $allowedTransitions; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var Enum[] |
||
| 24 | */ |
||
| 25 | protected $finishedStatus; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var Enum |
||
| 29 | */ |
||
| 30 | protected $currentStatus; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * WorkflowInterface constructor. |
||
| 34 | * @param Enum $initialStatus |
||
| 35 | */ |
||
| 36 | 12 | public function __construct(Enum $initialStatus) |
|
| 40 | |||
| 41 | /** |
||
| 42 | * @return Enum |
||
| 43 | */ |
||
| 44 | 7 | public function getCurrentStatus(): Enum |
|
| 48 | |||
| 49 | /** |
||
| 50 | * @return bool |
||
| 51 | */ |
||
| 52 | 4 | public function isFinished(): bool |
|
| 56 | |||
| 57 | /** |
||
| 58 | * @param Enum $status |
||
| 59 | * @throws InvalidTransitionException |
||
| 60 | */ |
||
| 61 | 12 | public function setCurrentStatus(Enum $status): void |
|
| 79 | } |
||
| 80 |