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

LogoutAction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A respond() 0 7 1
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