Completed
Push — master ( e09e40...2564b7 )
by Nils
02:09
created

SessionContainer   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A addSession() 0 4 1
A getSession() 0 4 1
A hasSession() 0 4 1
A getSessions() 0 4 1
A addContainer() 0 6 2
1
<?php
2
3
namespace whm\Smoke\Scanner;
4
5
use whm\Smoke\Http\Session;
6
7
class SessionContainer
8
{
9
    private $sessions = array();
10
11
    public function addSession($key, Session $session)
12
    {
13
        $this->sessions[$key] = $session;
14
    }
15
16
    /**
17
     * @param $key
18
     *
19
     * @return Session
20
     */
21
    public function getSession($key)
22
    {
23
        return $this->sessions[$key];
24
    }
25
26
    public function hasSession($key)
27
    {
28
        return array_key_exists($key, $this->sessions);
29
    }
30
31
    public function getSessions()
32
    {
33
        return $this->sessions;
34
    }
35
36
    public function addContainer(SessionContainer $sessionContainer)
37
    {
38
        foreach ($sessionContainer->getSessions() as $sessionName => $session) {
39
            $this->addSession($sessionName, $session);
40
        }
41
    }
42
}
43