Conditions | 3 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
21 | public function execute($command, callable $next) |
||
22 | { |
||
23 | if (!$subject = $command->storage) { |
||
24 | throw new \LogicException("Require storage before using this AuthenticationMiddleware!"); |
||
25 | } |
||
26 | |||
27 | if (!$command instanceof LogoutCommand) { |
||
28 | return $next($command); |
||
29 | } |
||
30 | |||
31 | /** @var User $subject */ |
||
32 | $subject->setLineLastLogin(null); |
||
33 | $subject->setState([User::START_STATE => 1]); |
||
34 | |||
35 | $command->message = new TextTemplate(); |
||
36 | $command->message->text = 'ออกจากระบบสำเร็จ !'; |
||
37 | |||
38 | return $next($command); |
||
39 | } |
||
41 |