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 ( 34b5b8...ec414b )
by Luis Ramón
02:59
created

Workday::getTrackedHours()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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