Channel   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 81
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 81
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0
wmc 6
lcom 0
cbo 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getName() 0 4 1
A setName() 0 6 1
A getPermission() 0 4 1
A setPermission() 0 6 1
A __toString() 0 4 1
1
<?php
2
3
namespace ninjacto\OrtcPhp\Models;
4
5
class Channel
6
{
7
    const PERMISSION_WRITE = 'w';
8
    const PERMISSION_READ = 'r';
9
10
    /**
11
     * Construct.
12
     *
13
     * @param string $name
14
     * @param string $permission
15
     */
16 4
    public function __construct($name = null, $permission = self::PERMISSION_READ)
17
    {
18 4
        $this->setName($name);
19 4
        $this->setPermission($permission);
20 4
    }
21
22
    /**
23
     * name of channel.
24
     *
25
     * @var string
26
     */
27
    private $name;
28
29
    /**
30
     * channel permission.
31
     *
32
     * @var string
33
     */
34
    private $permission;
35
36
    /**
37
     * @return string
38
     */
39 4
    public function getName()
40
    {
41 4
        return $this->name;
42
    }
43
44
    /**
45
     * @param string $name
46
     *
47
     * @return $this
48
     */
49 4
    public function setName($name)
50
    {
51 4
        $this->name = $name;
52
53 4
        return $this;
54
    }
55
56
    /**
57
     * @return string
58
     */
59 3
    public function getPermission()
60
    {
61 3
        return $this->permission;
62
    }
63
64
    /**
65
     * @param string $permission
66
     *
67
     * @return $this
68
     */
69 4
    public function setPermission($permission)
70
    {
71 4
        $this->permission = $permission;
72
73 4
        return $this;
74
    }
75
76
    /**
77
     * To string returned name.
78
     *
79
     * @return string
80
     */
81 1
    public function __toString()
82
    {
83 1
        return $this->getName();
84
    }
85
}
86