Intraface_Controller_Logout   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 10
c 0
b 0
f 0
ccs 0
cts 20
cp 0
wmc 4
lcom 2
cbo 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A execute() 0 5 1
A GET() 0 11 2
1
<?php
2
/**
3
 * Logout
4
 *
5
 * @package Intraface
6
 * @author  Lars Olesen <[email protected]>
7
 * @since   0.1.0
8
 * @version @package-version@
9
 */
10
class Intraface_Controller_Logout extends k_Component
11
{
12
    protected $auth;
13
14
    function __construct(Intraface_Auth $auth)
15
    {
16
        $this->auth = $auth;
17
    }
18
19
    function execute()
20
    {
21
        $this->url_state->init("continue", $this->url('/login'));
22
        return parent::execute();
23
    }
24
25
    function GET()
26
    {
27
        if ($this->auth->clearIdentity()) {
28
            $this->session()->set('identity', null);
0 ignored issues
show
Bug introduced by
The method set cannot be called on $this->session() (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
29
            $this->session()->destroy();
0 ignored issues
show
Bug introduced by
The method destroy cannot be called on $this->session() (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
30
            return new k_SeeOther($this->query('continue'));
31
        } else {
32
            throw new Exception('Could not logout');
33
        }
34
        return parent::GET();
0 ignored issues
show
Unused Code introduced by
return parent::GET(); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
35
    }
36
}
37