GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Calendar::getHoursFri()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/*
3
  GESTCONV - Aplicación web para la gestión de la convivencia en centros educativos
4
5
  Copyright (C) 2015: Luis Ramón López López
6
7
  This program is free software: you can redistribute it and/or modify
8
  it under the terms of the GNU Affero General Public License as published by
9
  the Free Software Foundation, either version 3 of the License, or
10
  (at your option) any later version.
11
12
  This program is distributed in the hope that it will be useful,
13
  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
  GNU Affero General Public License for more details.
16
17
  You should have received a copy of the GNU Affero General Public License
18
  along with this program.  If not, see [http://www.gnu.org/licenses/].
19
*/
20
21
namespace AppBundle\Form\Model;
22
23
use Symfony\Component\Validator\Constraints as Assert;
24
use Symfony\Component\Validator\Context\ExecutionContextInterface;
25
26
class Calendar
27
{
28
    /**
29
     * @var \DateTime
30
     */
31
    protected $startDate;
32
33
    /**
34
     * @Assert\GreaterThanOrEqual(value="1")
35
     * @var float
36
     */
37
    protected $totalHours;
38
39
    /**
40
     * @Assert\Range(min="0", max="24")
41
     * @var float
42
     */
43
    protected $hoursMon;
44
45
    /**
46
     * @Assert\Range(min="0", max="24")
47
     * @var float
48
     */
49
    protected $hoursTue;
50
51
    /**
52
     * @Assert\Range(min="0", max="24")
53
     * @var float
54
     */
55
    protected $hoursWed;
56
57
    /**
58
     * @Assert\Range(min="0", max="24")
59
     * @var float
60
     */
61
    protected $hoursThu;
62
63
    /**
64
     * @Assert\Range(min="0", max="24")
65
     * @var float
66
     */
67
    protected $hoursFri;
68
69
    /**
70
     * @Assert\Range(min="0", max="24")
71
     * @var float
72
     */
73
    protected $hoursSat;
74
75
    /**
76
     * @Assert\Range(min="0", max="24")
77
     * @var float
78
     */
79
    protected $hoursSun;
80
81
    public function __construct($total = 0.0)
82
    {
83
        $this->startDate = new \DateTime();
84
85
        $this->totalHours = $total;
86
87
        $this->hoursMon = 0.0;
88
        $this->hoursTue = 0.0;
89
        $this->hoursWed = 0.0;
90
        $this->hoursThu = 0.0;
91
        $this->hoursFri = 0.0;
92
        $this->hoursSat = 0.0;
93
        $this->hoursSun = 0.0;
94
    }
95
96
    /**
97
     * @return \DateTime
98
     */
99
    public function getStartDate()
100
    {
101
        return $this->startDate;
102
    }
103
104
    /**
105
     * @param \DateTime $startDate
106
     * @return Calendar
107
     */
108
    public function setStartDate($startDate)
109
    {
110
        $this->startDate = $startDate;
111
        return $this;
112
    }
113
114
    /**
115
     * @return float
116
     */
117
    public function getTotalHours()
118
    {
119
        return $this->totalHours;
120
    }
121
122
    /**
123
     * @param float $totalHours
124
     * @return Calendar
125
     */
126
    public function setTotalHours($totalHours)
127
    {
128
        $this->totalHours = $totalHours;
129
        return $this;
130
    }
131
132
    /**
133
     * @return float
134
     */
135
    public function getHoursMon()
136
    {
137
        return $this->hoursMon;
138
    }
139
140
    /**
141
     * @param float $hoursMon
142
     * @return Calendar
143
     */
144
    public function setHoursMon($hoursMon)
145
    {
146
        $this->hoursMon = $hoursMon;
147
        return $this;
148
    }
149
150
    /**
151
     * @return float
152
     */
153
    public function getHoursTue()
154
    {
155
        return $this->hoursTue;
156
    }
157
158
    /**
159
     * @param float $hoursTue
160
     * @return Calendar
161
     */
162
    public function setHoursTue($hoursTue)
163
    {
164
        $this->hoursTue = $hoursTue;
165
        return $this;
166
    }
167
168
    /**
169
     * @return float
170
     */
171
    public function getHoursWed()
172
    {
173
        return $this->hoursWed;
174
    }
175
176
    /**
177
     * @param float $hoursWed
178
     * @return Calendar
179
     */
180
    public function setHoursWed($hoursWed)
181
    {
182
        $this->hoursWed = $hoursWed;
183
        return $this;
184
    }
185
186
    /**
187
     * @return float
188
     */
189
    public function getHoursThu()
190
    {
191
        return $this->hoursThu;
192
    }
193
194
    /**
195
     * @param float $hoursThu
196
     * @return Calendar
197
     */
198
    public function setHoursThu($hoursThu)
199
    {
200
        $this->hoursThu = $hoursThu;
201
        return $this;
202
    }
203
204
    /**
205
     * @return float
206
     */
207
    public function getHoursFri()
208
    {
209
        return $this->hoursFri;
210
    }
211
212
    /**
213
     * @param float $hoursFri
214
     * @return Calendar
215
     */
216
    public function setHoursFri($hoursFri)
217
    {
218
        $this->hoursFri = $hoursFri;
219
        return $this;
220
    }
221
222
    /**
223
     * @return float
224
     */
225
    public function getHoursSat()
226
    {
227
        return $this->hoursSat;
228
    }
229
230
    /**
231
     * @param float $hoursSat
232
     * @return Calendar
233
     */
234
    public function setHoursSat($hoursSat)
235
    {
236
        $this->hoursSat = $hoursSat;
237
        return $this;
238
    }
239
240
    /**
241
     * @return float
242
     */
243
    public function getHoursSun()
244
    {
245
        return $this->hoursSun;
246
    }
247
248
    /**
249
     * @param float $hoursSun
250
     * @return Calendar
251
     */
252
    public function setHoursSun($hoursSun)
253
    {
254
        $this->hoursSun = $hoursSun;
255
        return $this;
256
    }
257
    
258
    /**
259
     * @Assert\Callback
260
     */
261
    public function validate(ExecutionContextInterface $context)
262
    {
263
        if ($this->getHoursMon() + $this->getHoursTue() + $this->getHoursWed()
264
            + $this->getHoursThu() + $this->getHoursFri()
265
            + $this->getHoursSat() + $this->getHoursSun() <= 0) {
266
        
267
            $context->buildViolation('calendar.no_hours')
268
                ->atPath('hoursMon')
269
                ->addViolation();
270
        }
271
    }
272
273
}
274