This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /** |
||
4 | * Storgman - Student Organizations Management |
||
5 | * Copyright (C) 2014-2016, Dejan Angelov <[email protected]> |
||
6 | * |
||
7 | * This file is part of Storgman. |
||
8 | * |
||
9 | * Storgman is free software: you can redistribute it and/or modify |
||
10 | * it under the terms of the GNU General Public License as published by |
||
11 | * the Free Software Foundation, either version 3 of the License, or |
||
12 | * (at your option) any later version. |
||
13 | * |
||
14 | * Storgman is distributed in the hope that it will be useful, |
||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
17 | * GNU General Public License for more details. |
||
18 | * |
||
19 | * You should have received a copy of the GNU General Public License |
||
20 | * along with Storgman. If not, see <http://www.gnu.org/licenses/>. |
||
21 | * |
||
22 | * @package Storgman |
||
23 | * @copyright Copyright (C) 2014-2016, Dejan Angelov <[email protected]> |
||
24 | * @license https://github.com/angelov/storgman/blob/master/LICENSE |
||
25 | * @author Dejan Angelov <[email protected]> |
||
26 | */ |
||
27 | |||
28 | namespace Angelov\Storgman\Meetings; |
||
29 | |||
30 | use Angelov\Storgman\Core\DateTime; |
||
31 | use Angelov\Storgman\Meetings\Attachments\Attachment; |
||
32 | use Angelov\Storgman\Members\Member; |
||
33 | use Illuminate\Database\Eloquent\Model; |
||
34 | |||
35 | class Meeting extends Model |
||
36 | { |
||
37 | protected $table = 'meetings'; |
||
38 | protected $dates = ["date"]; |
||
39 | |||
40 | public function __construct(array $attributes = []) |
||
41 | { |
||
42 | parent::__construct($attributes); |
||
43 | |||
44 | $this->setTitle('Untitled meeting'); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * List of members who attended the meeting |
||
49 | * |
||
50 | * @var Member[] $attendants |
||
51 | */ |
||
52 | protected $attendants = []; |
||
53 | |||
54 | /** |
||
55 | * @var Attachment[] $attachments |
||
56 | */ |
||
57 | protected $attachments = []; |
||
58 | |||
59 | public function getId() |
||
60 | { |
||
61 | return $this->getAttribute('id'); |
||
62 | } |
||
63 | |||
64 | public function getTitle() |
||
65 | { |
||
66 | return $this->getAttribute('title'); |
||
67 | } |
||
68 | |||
69 | public function setTitle($title) |
||
70 | { |
||
71 | $this->setAttribute('title', $title); |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * @return \DateTime |
||
76 | */ |
||
77 | public function getDate() |
||
78 | { |
||
79 | return $this->getAttribute('date'); |
||
80 | } |
||
81 | |||
82 | public function setDate(\DateTime $date) |
||
83 | { |
||
84 | $this->setAttribute('date', $date); |
||
85 | } |
||
86 | |||
87 | public function getTime() |
||
88 | { |
||
89 | return $this->getDate(); |
||
90 | } |
||
91 | |||
92 | public function hasPassed() |
||
93 | { |
||
94 | return $this->getDate() < (new DateTime()); |
||
95 | } |
||
96 | |||
97 | public function getLocation() |
||
98 | { |
||
99 | return $this->getAttribute('location'); |
||
100 | } |
||
101 | |||
102 | public function setLocation($location) |
||
103 | { |
||
104 | $this->setAttribute('location', $location); |
||
105 | } |
||
106 | |||
107 | public function getInfo() |
||
108 | { |
||
109 | return $this->getAttribute('info'); |
||
110 | } |
||
111 | |||
112 | public function setInfo($info) |
||
113 | { |
||
114 | $this->setAttribute('info', $info); |
||
115 | } |
||
116 | |||
117 | /** |
||
118 | * @return \DateTime |
||
119 | */ |
||
120 | public function getCreatedAt() |
||
121 | { |
||
122 | return $this->getAttribute('created_at'); |
||
123 | } |
||
124 | |||
125 | /** |
||
126 | * @return \DateTime |
||
127 | */ |
||
128 | public function getUpdatedAt() |
||
129 | { |
||
130 | return $this->getAttribute('updated_at'); |
||
131 | } |
||
132 | |||
133 | /** |
||
134 | * @return Member[] |
||
135 | */ |
||
136 | public function getAttendants() |
||
137 | { |
||
138 | return $this->getAttribute('attendants')->all(); |
||
139 | } |
||
140 | |||
141 | /** |
||
142 | * @param Member[] $attendants |
||
143 | */ |
||
144 | public function addAttendants(array $attendants) |
||
145 | { |
||
146 | $this->attendants = array_merge($this->attendants, $attendants); |
||
147 | } |
||
148 | |||
149 | /** |
||
150 | * @param Member[] $attendants |
||
151 | */ |
||
152 | public function syncAttendants(array $attendants) |
||
153 | { |
||
154 | $ids = []; |
||
155 | |||
156 | foreach ($attendants as $attendant) { |
||
157 | if ($attendant instanceof Member) { |
||
158 | $ids[] = $attendant->getId(); |
||
159 | } |
||
160 | } |
||
161 | |||
162 | $this->attendants()->sync($ids); |
||
163 | } |
||
164 | |||
165 | public function hasAttendants() |
||
166 | { |
||
167 | return count($this->attendants) > 0; |
||
168 | } |
||
169 | |||
170 | public function wasAttendedBy(Member $member) |
||
171 | { |
||
172 | foreach ($this->getAttendants() as $attendant) { |
||
173 | if ($attendant->getId() == $member->getId()) { |
||
174 | return true; |
||
175 | } |
||
176 | } |
||
177 | |||
178 | return false; |
||
179 | } |
||
180 | |||
181 | public function setCreator(Member $creator) |
||
182 | { |
||
183 | $this->creator()->associate($creator); |
||
184 | } |
||
185 | |||
186 | /** |
||
187 | * @return Member |
||
188 | */ |
||
189 | public function getCreator() |
||
190 | { |
||
191 | return $this->creator; |
||
0 ignored issues
–
show
|
|||
192 | } |
||
193 | |||
194 | public function attendants() |
||
195 | { |
||
196 | return $this->belongsToMany(Member::class); |
||
197 | } |
||
198 | |||
199 | public function creator() |
||
200 | { |
||
201 | return $this->belongsTo(Member::class, 'created_by'); |
||
202 | } |
||
203 | |||
204 | public function attachments() |
||
205 | { |
||
206 | return $this->hasMany(Attachment::class, 'meeting_id'); |
||
207 | } |
||
208 | |||
209 | public function hasAttachments() |
||
210 | { |
||
211 | return count($this->getAttachments()) > 0; |
||
212 | } |
||
213 | |||
214 | /** |
||
215 | * @param Attachment[] $attachments |
||
216 | */ |
||
217 | public function addAttachments(array $attachments) |
||
218 | { |
||
219 | $this->attachments = array_merge($this->attachments, $attachments); |
||
220 | } |
||
221 | |||
222 | /** |
||
223 | * @return Attachment[] |
||
224 | */ |
||
225 | public function getAttachments() |
||
226 | { |
||
227 | return $this->getAttribute('attachments')->all(); |
||
228 | } |
||
229 | |||
230 | public function hasReport() |
||
231 | { |
||
232 | return $this->attendants()->count() != 0 || $this->getMinutes() != ""; |
||
233 | } |
||
234 | |||
235 | public function needsReport() |
||
236 | { |
||
237 | return $this->hasPassed() && !$this->hasReport(); |
||
238 | } |
||
239 | |||
240 | public function reportAuthor() |
||
241 | { |
||
242 | return $this->belongsTo(Member::class, 'report_author'); |
||
243 | } |
||
244 | |||
245 | /** |
||
246 | * @return Member |
||
247 | */ |
||
248 | public function getReportAuthor() |
||
249 | { |
||
250 | return $this->reportAuthor; |
||
0 ignored issues
–
show
The property
reportAuthor does not exist on object<Angelov\Storgman\Meetings\Meeting> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
251 | } |
||
252 | |||
253 | public function setReportAuthor(Member $member) |
||
254 | { |
||
255 | $this->reportAuthor()->associate($member); |
||
256 | } |
||
257 | |||
258 | public function getMinutes() |
||
259 | { |
||
260 | return $this->getAttribute('minutes'); |
||
261 | } |
||
262 | |||
263 | public function setMinutes($minutes) |
||
264 | { |
||
265 | $this->setAttribute('minutes', $minutes); |
||
266 | } |
||
267 | |||
268 | public function save(array $options = []) |
||
269 | { |
||
270 | parent::save($options); |
||
271 | |||
272 | if (count($this->attendants) > 0) { |
||
273 | $this->syncAttendants($this->attendants); |
||
274 | } |
||
275 | |||
276 | if (count($this->attachments) > 0) { |
||
277 | $this->attachments()->saveMany($this->attachments); |
||
278 | } |
||
279 | } |
||
280 | } |
||
281 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.