Week   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 0
dl 0
loc 69
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getName() 0 4 1
A setName() 0 4 1
A getTrainings() 0 4 1
A addTraining() 0 4 1
A __toString() 0 9 2
1
<?php
2
3
namespace Cp\DomainObject;
4
5
use JMS\Serializer\Annotation as JMS;
6
7
class Week
8
{
9
    /**
10
     * @var string
11
     *
12
     * @JMS\Type("string")
13
     */
14
    private $name;
15
16
    /**
17
     * @var array
18
     *
19
     * @JMS\Type("array<Cp\DomainObject\Training>")
20
     */
21
    private $trainings;
22
23
    /**
24
     * WeekTraining constructor.
25
     */
26
    public function __construct()
27
    {
28
        $this->trainings = [];
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    public function getName()
35
    {
36
        return $this->name;
37
    }
38
39
    /**
40
     * @param string $name
41
     */
42
    public function setName($name)
43
    {
44
        $this->name = $name;
45
    }
46
47
    /**
48
     * @return array
49
     */
50
    public function getTrainings()
51
    {
52
        return $this->trainings;
53
    }
54
55
    /**
56
     * @param Training $training
57
     */
58
    public function addTraining(Training $training)
59
    {
60
        $this->trainings[] = $training;
61
    }
62
63
    /**
64
     * @return string
65
     */
66
    public function __toString()
67
    {
68
        $stream = $this->getName()."\n";
69
        foreach ($this->getTrainings() as $training) {
70
            $stream .= (string) $training;
71
        }
72
73
        return $stream;
74
    }
75
}
76