Plan::setName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Cp\DomainObject;
4
5
use JMS\Serializer\Annotation as JMS;
6
7
/**
8
 * Class Plan
9
 */
10
class Plan
11
{
12
    /**
13
     * @var string
14
     *
15
     * @JMS\Type("string")
16
     */
17
    private $name;
18
19
    /**
20
     * @var string
21
     *
22
     * @JMS\Type("string")
23
     */
24
    private $type;
25
26
    /**
27
     * @var array
28
     *
29
     * @JMS\Type("array<Cp\DomainObject\Week>")
30
     */
31
    private $weeks;
32
33
    /**
34
     * @var Configuration
35
     */
36
    private $configuration;
37
38
39
    /**
40
     * PlanTraining constructor.
41
     */
42
    public function __construct()
43
    {
44
        $this->weeks = [];
45
    }
46
47
    /**
48
     * @return string
49
     */
50
    public function getName()
51
    {
52
        return $this->name;
53
    }
54
55
    /**
56
     * @param string $name
57
     */
58
    public function setName($name)
59
    {
60
        $this->name = $name;
61
    }
62
63
    /**
64
     * @return string
65
     */
66
    public function getType()
67
    {
68
        return $this->type;
69
    }
70
71
    /**
72
     * @param string $type
73
     */
74
    public function setType($type)
75
    {
76
        $this->type = $type;
77
    }
78
79
    /**
80
     * @return array
81
     */
82
    public function getWeeks()
83
    {
84
        return $this->weeks;
85
    }
86
87
    /**
88
     * @param Week $week
89
     */
90
    public function addWeek(Week $week)
91
    {
92
        $this->weeks[] = $week;
93
    }
94
95
    /**
96
     * @return Configuration
97
     */
98
    public function getConfiguration()
99
    {
100
        return $this->configuration;
101
    }
102
103
    /**
104
     * @param Configuration $configuration
105
     */
106
    public function setConfiguration($configuration)
107
    {
108
        $this->configuration = $configuration;
109
    }
110
111
    /**
112
     * @return string
113
     */
114
    public function __toString()
115
    {
116
        $stream = $this->getType().':'.$this->getName()."\n";
117
        foreach ($this->getWeeks() as $week) {
118
            $stream .= (string) $week;
119
        }
120
121
        return $stream;
122
    }
123
}
124