Passed
Push — master ( 6d02c4...011dd0 )
by Javier
02:30
created
src/StateMachine.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -20,8 +20,9 @@  discard block
 block discarded – undo
20 20
 	
21 21
 	public function __construct(StateMachineBuilder $smb = null)
22 22
     {
23
-        if(  $smb != null )
24
-            $sm = $smb->__invoke();
23
+        if(  $smb != null ) {
24
+                    $sm = $smb->__invoke();
25
+        }
25 26
 
26 27
         if( ! empty($sm) ){
27 28
             // StateEnum::CURRENT_STATE => [ EventEnum::ON_EVENT => [ StateEnum::NEXT_STATE_2, ActionClosureOrFunction ]  ],
@@ -149,26 +150,30 @@  discard block
 block discarded – undo
149 150
 
150 151
     private function argumentIsNotNullOrFail($arg): void
151 152
     {
152
-        if( $arg === null )
153
-            throw new \InvalidArgumentException("Null is not an valid argument");
153
+        if( $arg === null ) {
154
+                    throw new \InvalidArgumentException("Null is not an valid argument");
155
+        }
154 156
     }
155 157
 
156 158
     private function argumentIsNotBlankOrFail($arg): void
157 159
     {
158
-        if( trim($arg) === "" )
159
-            throw new \InvalidArgumentException("Blank is not an valid argument");
160
+        if( trim($arg) === "" ) {
161
+                    throw new \InvalidArgumentException("Blank is not an valid argument");
162
+        }
160 163
     }
161 164
 
162 165
     private function eventMustExistOrFail($event)
163 166
     {
164
-        if( !( isset($this->sm[$this->currentState][$event]) || isset($this->commonTransition[$event]) ) )
165
-            throw new \InvalidArgumentException("Unexpected event {$event} on {$this->currentState} state");
167
+        if( !( isset($this->sm[$this->currentState][$event]) || isset($this->commonTransition[$event]) ) ) {
168
+                    throw new \InvalidArgumentException("Unexpected event {$event} on {$this->currentState} state");
169
+        }
166 170
     }
167 171
 
168 172
     private function stateMustExistOrFail($state)
169 173
     {
170
-        if( ! isset($this->sm[$this->currentState]) )
171
-            throw new \InvalidArgumentException("Event {$this->currentEvent} fired an unexpected {$this->currentState} state");
174
+        if( ! isset($this->sm[$this->currentState]) ) {
175
+                    throw new \InvalidArgumentException("Event {$this->currentEvent} fired an unexpected {$this->currentState} state");
176
+        }
172 177
     }
173 178
 
174 179
     private function setCurrentStateIfThisIsInitialState($state): void
Please login to merge, or discard this patch.