Completed
Pull Request — master (#5)
by Ruben
03:27
created

Channel   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 89
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 18.18%

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 0
dl 0
loc 89
ccs 4
cts 22
cp 0.1818
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setName() 0 6 1
A setId() 0 6 1
A getParent() 0 4 1
A setParentOnChildren() 0 6 2
A getChildren() 0 4 1
A setChildren() 0 6 1
A getName() 0 4 1
A getId() 0 4 1
1
<?php
2
3
namespace MovingImage\Client\VMPro\Entity;
4
5
use JMS\Serializer\Annotation\Type;
6
7
/**
8
 * Class Channel.
9
 *
10
 * @author Ruben Knol <[email protected]>
11
 */
12
class Channel
13
{
14
    /**
15
     * @Type("integer")
16
     */
17
    private $id;
18
19
    /**
20
     * @Type("string")
21
     */
22
    private $name;
23
24
    /**
25
     * @Type("ArrayCollection<MovingImage\Client\VMPro\Entity\Channel>")
26
     */
27
    private $children;
28
29
    /**
30
     * @Type("MovingImage\Client\VMPro\Entity\Channel")
31
     */
32
    private $parent = null;
33
34
    /**
35
     * @return string
36
     */
37 6
    public function getName()
38
    {
39 6
        return $this->name;
40
    }
41
42
    /**
43
     * @param string $name
44
     *
45
     * @return Channel
46
     */
47
    public function setName($name)
48
    {
49
        $this->name = $name;
50
51
        return $this;
52
    }
53
54
    /**
55
     * @return int
56
     */
57 6
    public function getId()
58
    {
59 6
        return $this->id;
60
    }
61
62
    /**
63
     * @param int $id
64
     *
65
     * @return Channel
66
     */
67
    public function setId($id)
68
    {
69
        $this->id = $id;
70
71
        return $this;
72
    }
73
74
    /**
75
     * @return Channel
76
     */
77
    public function getParent()
78
    {
79
        return $this->parent;
80
    }
81
82
    public function setParentOnChildren()
83
    {
84
        foreach ($this->getChildren() as $child) {
85
            $child->parent = $this;
86
        }
87
    }
88
89
    public function getChildren()
90
    {
91
        return $this->children;
92
    }
93
94
    public function setChildren($children)
95
    {
96
        $this->children = $children;
97
98
        return $this;
99
    }
100
}
101