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