Channel::getPermission()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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