Conditions | 4 |
Paths | 3 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
24 | public function execute($command, callable $next) |
||
25 | { |
||
26 | if (!$command->storage) { |
||
27 | throw new \LogicException("Require storage before using this middleware!"); |
||
28 | } |
||
29 | |||
30 | if (!$command->secured) { |
||
31 | return $next($command); |
||
32 | } |
||
33 | |||
34 | if (!$this->isSecureExpired($command->storage)) { |
||
35 | return $next($command); |
||
36 | } |
||
37 | |||
38 | $cmd = new LoginCommand(); |
||
39 | $cmd->input = $command->input; |
||
40 | $cmd->storage = $command->storage; |
||
41 | $cmd->logs = $command->logs; |
||
42 | |||
43 | $command['switchTo'] = $cmd; |
||
44 | |||
45 | return $next($command); |
||
46 | |||
68 |