@@ -19,8 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | public function __construct(StateMachineBuilder $smb = null) |
21 | 21 | { |
22 | - if( $smb != null ) |
|
23 | - $sm = $smb->__invoke(); |
|
22 | + if( $smb != null ) { |
|
23 | + $sm = $smb->__invoke(); |
|
24 | + } |
|
24 | 25 | |
25 | 26 | if( ! empty($sm) ){ |
26 | 27 | // StateEnum::CURRENT_STATE => [ EventEnum::ON_EVENT => [ StateEnum::NEXT_STATE_2, ActionClosureOrFunction ] ], |
@@ -152,26 +153,30 @@ discard block |
||
152 | 153 | |
153 | 154 | private function argumentIsNotNullOrFail($arg): void |
154 | 155 | { |
155 | - if( $arg === null ) |
|
156 | - throw new \InvalidArgumentException("Null is not an valid argument"); |
|
156 | + if( $arg === null ) { |
|
157 | + throw new \InvalidArgumentException("Null is not an valid argument"); |
|
158 | + } |
|
157 | 159 | } |
158 | 160 | |
159 | 161 | private function argumentIsNotBlankOrFail($arg): void |
160 | 162 | { |
161 | - if( trim($arg) === "" ) |
|
162 | - throw new \InvalidArgumentException("Blank is not an valid argument"); |
|
163 | + if( trim($arg) === "" ) { |
|
164 | + throw new \InvalidArgumentException("Blank is not an valid argument"); |
|
165 | + } |
|
163 | 166 | } |
164 | 167 | |
165 | 168 | private function eventMustExistOrFail($event) |
166 | 169 | { |
167 | - if( !( isset($this->sm[$this->currentState][$event]) ) ) |
|
168 | - throw new \InvalidArgumentException("Unexpected event {$event} on {$this->currentState} state"); |
|
170 | + if( !( isset($this->sm[$this->currentState][$event]) ) ) { |
|
171 | + throw new \InvalidArgumentException("Unexpected event {$event} on {$this->currentState} state"); |
|
172 | + } |
|
169 | 173 | } |
170 | 174 | |
171 | 175 | private function stateMustExistOrFail($state) |
172 | 176 | { |
173 | - if( ! isset($this->sm[$state]) ) |
|
174 | - throw new \InvalidArgumentException("Event '{$this->currentEvent}' fired an unexpected '{$state}' state"); |
|
177 | + if( ! isset($this->sm[$state]) ) { |
|
178 | + throw new \InvalidArgumentException("Event '{$this->currentEvent}' fired an unexpected '{$state}' state"); |
|
179 | + } |
|
175 | 180 | } |
176 | 181 | |
177 | 182 | private function setCurrentStateIfThisIsInitialState($state): void |