Passed
Push — master ( 11848a...152feb )
by nguereza
13:16 queued 12s
created

LogoutAction::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 8
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Platine\App\Http\Action\User;
6
7
use Platine\Framework\Auth\AuthenticationInterface;
8
use Platine\Framework\Helper\ActionHelper;
9
use Platine\Framework\Http\Action\BaseAction;
10
use Platine\Http\ResponseInterface;
11
12
/**
13
* @class LogoutAction
14
* @package Platine\App\Http\Action\User
15
* @template T
16
* @extends BaseAction<T> 
17
*/
18
class LogoutAction extends BaseAction
19
{
20
    /**
21
    * Create new instance
22
    * @param AuthenticationInterface $authentication
23
    * @param ActionHelper<T> $actionHelper
24
    */
25
    public function __construct(
26
        protected AuthenticationInterface $authentication,
27
        ActionHelper $actionHelper,
28
    ) {
29
        parent::__construct($actionHelper);
30
    }
31
32
    /**
33
    * {@inheritdoc}
34
    */
35
    public function respond(): ResponseInterface
36
    {
37
        $this->authentication->logout();
38
39
        $this->flash->setInfo($this->lang->tr('You are successfully logged out'));
40
41
        return $this->redirect('user_login');
42
    }
43
}
44