| Conditions | 7 | 
| Paths | 5 | 
| Total Lines | 30 | 
| Code Lines | 15 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 25 | public function execute($command, callable $next) | ||
| 26 |     { | ||
| 27 |         if (!$command->storage) { | ||
| 28 |             throw new \LogicException("Require storage before using this AuthenticationMiddleware!"); | ||
| 29 | } | ||
| 30 | |||
| 31 |         if (!$command instanceof LoginCommand) { | ||
| 32 | return $next($command); | ||
| 33 | } | ||
| 34 | |||
| 35 | $command->active = true; | ||
| 36 | $command->message = new TextTemplate(); | ||
| 37 | |||
| 38 |         if ($this->workflow->doApplyStart($command)) { | ||
| 39 | return $next($command); | ||
| 40 | } | ||
| 41 | |||
| 42 |         if ($this->workflow->doApplyEnterUsernameAndPassword($command)) { | ||
| 43 | return $next($command); | ||
| 44 | } | ||
| 45 | |||
| 46 |         if ($this->workflow->doApplyEnterUsername($command)) { | ||
| 47 | return $next($command); | ||
| 48 | } | ||
| 49 | |||
| 50 |         if ($this->workflow->doApplyEnterPassword($command)) { | ||
| 51 | return $next($command); | ||
| 52 | } | ||
| 53 | |||
| 54 |         throw new \LogicException("Unknown case!"); | ||
| 55 | } | ||
| 57 |