Passed
Push — master ( 4b954d...b01812 )
by Gabor
03:38
created

LogoutAction::getTemplateName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * WebHemi.
4
 *
5
 * PHP version 5.6
6
 *
7
 * @copyright 2012 - 2016 Gixx-web (http://www.gixx-web.com)
8
 * @license   https://opensource.org/licenses/MIT The MIT License (MIT)
9
 *
10
 * @link      http://www.gixx-web.com
11
 */
12
13
namespace WebHemi\Middleware\Action\Auth;
14
15
use WebHemi\Adapter\Auth\AuthAdapterInterface;
16
use WebHemi\Adapter\Http\ResponseInterface;
17
use WebHemi\Middleware\AbstractMiddlewareAction;
18
19
/**
20
 * Class LogoutAction
21
 */
22
class LogoutAction extends AbstractMiddlewareAction
23
{
24
    /** @var AuthAdapterInterface */
25
    private $authAdapter;
26
27
    /**
28
     * MetaDataAction constructor.
29
     *
30
     * @param AuthAdapterInterface $authAdapter
31
     */
32
    public function __construct(AuthAdapterInterface $authAdapter)
33
    {
34
        $this->authAdapter = $authAdapter;
35
    }
36
37
    /**
38
     * Gets template map name or template file path.
39
     *
40
     * @return string
41
     */
42
    public function getTemplateName()
43
    {
44
        return '';
45
    }
46
47
    /**
48
     * Gets template data.
49
     *
50
     * @return array
51
     */
52
    public function getTemplateData()
53
    {
54
        $this->authAdapter->clearIdentity();
55
        $this->response = $this->response->withStatus(ResponseInterface::STATUS_REDIRECT, 'Found')
56
            ->withHeader('Location', '/');
57
58
        return [];
59
    }
60
}
61