| 1 | <?php |
||
| 10 | trait StateMaintainer |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * The object's current state |
||
| 14 | * |
||
| 15 | * @var State |
||
| 16 | */ |
||
| 17 | private $currentState; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * {@inheritdoc} |
||
| 21 | */ |
||
| 22 | 15 | public function hasCurrentState() : bool |
|
| 26 | |||
| 27 | /** |
||
| 28 | * {@inheritdoc} |
||
| 29 | */ |
||
| 30 | 10 | public function getCurrentState() : State |
|
| 36 | |||
| 37 | /** |
||
| 38 | * {@inheritdoc} |
||
| 39 | * |
||
| 40 | */ |
||
| 41 | 4 | public function getCurrentStateName() : string |
|
| 47 | |||
| 48 | /** |
||
| 49 | * {@inheritdoc} |
||
| 50 | */ |
||
| 51 | 12 | public function setCurrentState(State $currentState) |
|
| 55 | |||
| 56 | /** |
||
| 57 | * Checks if the object has a current state set and throws an exception if not. |
||
| 58 | * |
||
| 59 | * @throws StateNotSet If the object does not have a current state |
||
| 60 | */ |
||
| 61 | 13 | private function assertHasCurrentState() |
|
| 68 | } |
||
| 69 |