Session   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 51
c 0
b 0
f 0
wmc 6
lcom 1
cbo 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setUserIdKey() 0 4 1
A getUserIdKey() 0 4 1
A getUserId() 0 4 1
A login() 0 4 1
A isLogged() 0 4 1
A logout() 0 4 1
1
<?php
2
namespace Sesshin\User;
3
4
use Sesshin\Session as BaseSession;
5
6
class Session extends BaseSession
7
{
8
    private $userIdKey = '_user_id';
9
10
    /**
11
     * @param string $userIdKey
12
     */
13
    public function setUserIdKey($userIdKey)
14
    {
15
        $this->userIdKey = $userIdKey;
16
    }
17
18
    /**
19
     * @return string
20
     */
21
    public function getUserIdKey()
22
    {
23
        return $this->userIdKey;
24
    }
25
26
    /**
27
     * @return mixed
28
     */
29
    public function getUserId()
30
    {
31
        return $this->getValue($this->getUserIdKey());
32
    }
33
34
    /**
35
     * @param string $userId
36
     */
37
    public function login($userId)
38
    {
39
        $this->setValue($this->getUserIdKey(), $userId);
40
    }
41
42
    /**
43
     * @return bool
44
     */
45
    public function isLogged()
46
    {
47
        return !is_null($this->getUserId());
48
    }
49
50
    /**
51
     */
52
    public function logout()
53
    {
54
        $this->unsetValue($this->getUserIdKey());
55
    }
56
}
57