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.
Completed
Push — user-entity ( 6db575...67b804 )
by Luis Ramón
02:52
created

Workday::isLocked()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/*
3
  ÁTICA - Aplicación web para la gestión documental de centros educativos
4
5
  Copyright (C) 2015-2016: 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\Entity;
22
23
use AppBundle\Entity\Agreement;
24
use Doctrine\Common\Collections\ArrayCollection;
25
use Doctrine\Common\Collections\Collection;
26
use Doctrine\ORM\Mapping as ORM;
27
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
28
29
/**
30
 * @ORM\Entity(repositoryClass="WorkdayRepository")
31
 * @UniqueEntity(fields={"agreement", "date"})
32
 */
33
class Workday
34
{
35
    /**
36
     * @ORM\Id
37
     * @ORM\GeneratedValue
38
     * @ORM\Column(type="integer")
39
     * @var int
40
     */
41
    protected $id;
42
    
43
    /**
44
     * @ORM\ManyToOne(targetEntity="Agreement", inversedBy="workdays")
45
     * @var Agreement
46
     */
47
    protected $agreement;
48
49
    /**
50
     * @ORM\Column(type="date")
51
     * @var \DateTime
52
     */
53
    protected $date;
54
55
    /**
56
     * @ORM\Column(type="text", nullable=true)
57
     * @var string
58
     */
59
    protected $notes;
60
61
    /**
62
     * @ORM\Column(type="float")
63
     * @var float
64
     */
65
    protected $hours;
66
67
    /**
68
     * @ORM\OneToMany(targetEntity="Tracking", mappedBy="workday", fetch="EAGER")
69
     * @var Collection
70
     */
71
    protected $trackingActivities;
72
73
    /**
74
     * @ORM\Column(type="boolean")
75
     * @var bool
76
     */
77
    protected $locked;
78
79
    /**
80
     * Get id
81
     *
82
     * @return integer
83
     */
84
    public function getId()
85
    {
86
        return $this->id;
87
    }
88
89
    /**
90
     * Set date
91
     *
92
     * @param \DateTime $date
93
     *
94
     * @return Workday
95
     */
96
    public function setDate($date)
97
    {
98
        $this->date = $date;
99
100
        return $this;
101
    }
102
103
    /**
104
     * Get date
105
     *
106
     * @return \DateTime
107
     */
108
    public function getDate()
109
    {
110
        return $this->date;
111
    }
112
    
113
    /**
114
     * Set notes
115
     *
116
     * @param string $notes
117
     *
118
     * @return Workday
119
     */
120
    public function setNotes($notes)
121
    {
122
        $this->notes = $notes;
123
124
        return $this;
125
    }
126
127
    /**
128
     * Get notes
129
     *
130
     * @return string
131
     */
132
    public function getNotes()
133
    {
134
        return $this->notes;
135
    }
136
137
    /**
138
     * Set hours
139
     *
140
     * @param float $hours
141
     *
142
     * @return Workday
143
     */
144
    public function setHours($hours)
145
    {
146
        $this->hours = $hours;
147
148
        return $this;
149
    }
150
151
    /**
152
     * Get hours
153
     *
154
     * @return float
155
     */
156
    public function getHours()
157
    {
158
        return $this->hours;
159
    }
160
161
    /**
162
     * Set agreement
163
     *
164
     * @param Agreement $agreement
165
     *
166
     * @return Workday
167
     */
168
    public function setAgreement(Agreement $agreement = null)
169
    {
170
        $this->agreement = $agreement;
171
172
        return $this;
173
    }
174
175
    /**
176
     * Get agreement
177
     *
178
     * @return Agreement
179
     */
180
    public function getAgreement()
181
    {
182
        return $this->agreement;
183
    }
184
    /**
185
     * Constructor
186
     */
187
    public function __construct()
188
    {
189
        $this->trackingActivities = new ArrayCollection();
190
        $this->setLocked(false);
191
    }
192
193
    /**
194
     * Add trackingActivity
195
     *
196
     * @param Tracking $trackingActivity
197
     *
198
     * @return Workday
199
     */
200
    public function addTrackingActivity(Tracking $trackingActivity)
201
    {
202
        $this->trackingActivities[] = $trackingActivity;
203
204
        return $this;
205
    }
206
207
    /**
208
     * Remove trackingActivity
209
     *
210
     * @param Tracking $trackingActivity
211
     */
212
    public function removeTrackingActivity(Tracking $trackingActivity)
213
    {
214
        $this->trackingActivities->removeElement($trackingActivity);
215
    }
216
217
    /**
218
     * Get trackingActivities
219
     *
220
     * @return \Doctrine\Common\Collections\Collection
221
     */
222
    public function getTrackingActivities()
223
    {
224
        return $this->trackingActivities;
225
    }
226
227
    public function getTrackedHours()
228
    {
229
        $hours = 0;
230
        /** @var Tracking $track */
231
        foreach ($this->getTrackingActivities() as $track) {
232
            $hours += $track->getHours();
233
        }
234
235
        return $hours;
236
    }
237
238
    /**
239
     * Set locked
240
     *
241
     * @param boolean $locked
242
     *
243
     * @return Workday
244
     */
245
    public function setLocked($locked)
246
    {
247
        $this->locked = $locked;
248
249
        return $this;
250
    }
251
252
    /**
253
     * Is locked
254
     *
255
     * @return boolean
256
     */
257
    public function isLocked()
258
    {
259
        return $this->locked;
260
    }
261
}
262