Connection::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 10
rs 9.4285
cc 2
eloc 7
nc 2
nop 3
1
<?php
2
3
/*
4
 * This file is part of the Tidal/WampWatch package.
5
 *   (c) 2016 Timo Michna <timomichna/yahoo.de>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 *
10
 */
11
12
namespace Tidal\WampWatch\Model;
13
14
use Tidal\WampWatch\Model\Property\Object\HasRouterTrait;
15
use Tidal\WampWatch\Model\Property\Object\HasRealmTrait;
16
use Tidal\WampWatch\Model\Property\Object\HasSessionTrait;
17
18
class Connection implements Contract\ConnectionInterface
19
{
20
    use HasRouterTrait;
21
    use HasRealmTrait;
22
    use HasSessionTrait;
23
24
    public function __construct(Contract\RouterInterface $router,
25
                                Contract\RealmInterface $realm,
26
                                Contract\SessionInterface $session = null
27
    ) {
28
        $this->setRouter($router);
29
        $this->setRealm($realm);
30
        if ($session !== null) {
31
            $this->confirm($session);
32
        }
33
    }
34
35
    public function confirm(Contract\SessionInterface $session)
36
    {
37
        $this->setSession($session);
38
    }
39
}
40