These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\DashboardBundle\Entity; |
||
4 | |||
5 | use Doctrine\ORM\Mapping as ORM; |
||
6 | use Kunstmaan\AdminBundle\Entity\AbstractEntity; |
||
7 | |||
8 | /** |
||
9 | * AnalyticsOverview |
||
10 | * |
||
11 | * @ORM\Table(name="kuma_analytics_overview") |
||
12 | * @ORM\Entity(repositoryClass="Kunstmaan\DashboardBundle\Repository\AnalyticsOverviewRepository") |
||
13 | */ |
||
14 | class AnalyticsOverview extends AbstractEntity |
||
15 | { |
||
16 | /** |
||
17 | * @ORM\ManyToOne(targetEntity="AnalyticsConfig", inversedBy="overviews") |
||
18 | * @ORM\JoinColumn(name="config_id", referencedColumnName="id") |
||
19 | */ |
||
20 | private $config; |
||
21 | |||
22 | /** |
||
23 | * @ORM\ManyToOne(targetEntity="AnalyticsSegment", inversedBy="overviews") |
||
24 | * @ORM\JoinColumn(name="segment_id", referencedColumnName="id", nullable=true) |
||
25 | */ |
||
26 | private $segment = null; |
||
27 | |||
28 | /** |
||
29 | * @ORM\OneToMany(targetEntity="AnalyticsGoal", mappedBy="overview", cascade={"persist", "remove"}) |
||
30 | * @ORM\OrderBy({"name" = "ASC"}) |
||
31 | */ |
||
32 | private $goals; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | * |
||
37 | * @ORM\Column(name="title", type="string", length=255) |
||
38 | */ |
||
39 | private $title; |
||
40 | |||
41 | /** |
||
42 | * @var integer |
||
43 | * |
||
44 | * @ORM\Column(name="timespan", type="integer") |
||
45 | */ |
||
46 | private $timespan; |
||
47 | |||
48 | /** |
||
49 | * @var integer |
||
50 | * |
||
51 | * @ORM\Column(name="start_days_ago", type="integer") |
||
52 | */ |
||
53 | private $startOffset = 0; |
||
54 | |||
55 | /** |
||
56 | * @var boolean |
||
57 | * |
||
58 | * @ORM\Column(name="use_year", type="boolean") |
||
59 | */ |
||
60 | private $useYear = false; |
||
61 | |||
62 | /** |
||
63 | * @var integer |
||
64 | * |
||
65 | * @ORM\Column(name="sessions", type="integer") |
||
66 | */ |
||
67 | private $sessions = 0; |
||
68 | |||
69 | /** |
||
70 | * @var integer |
||
71 | * |
||
72 | * @ORM\Column(name="users", type="integer") |
||
73 | */ |
||
74 | private $users = 0; |
||
75 | |||
76 | /** |
||
77 | * @var integer |
||
78 | * |
||
79 | * @ORM\Column(name="returning_users", type="integer") |
||
80 | */ |
||
81 | private $returningUsers = 0; |
||
82 | |||
83 | /** |
||
84 | * @var float |
||
85 | * |
||
86 | * @ORM\Column(name="new_users", type="float") |
||
87 | */ |
||
88 | private $newUsers = 0; |
||
89 | |||
90 | /** |
||
91 | * @var integer |
||
92 | * |
||
93 | * @ORM\Column(name="pageviews", type="integer") |
||
94 | */ |
||
95 | private $pageviews = 0; |
||
96 | |||
97 | /** |
||
98 | * @var float |
||
99 | * |
||
100 | * @ORM\Column(name="pages_per_session", type="float") |
||
101 | */ |
||
102 | private $pagesPerSession = 0; |
||
103 | |||
104 | /** |
||
105 | * @var integer |
||
106 | * |
||
107 | * @ORM\Column(name="chart_data_max_value", type="integer") |
||
108 | */ |
||
109 | private $chartDataMaxValue = 0; |
||
110 | |||
111 | /** |
||
112 | * @var string |
||
113 | * |
||
114 | * @ORM\Column(name="avg_session_duration", type="string") |
||
115 | */ |
||
116 | private $avgSessionDuration = 0; |
||
117 | |||
118 | /** |
||
119 | * @var array |
||
120 | * |
||
121 | * @ORM\Column(name="chart_data", type="text") |
||
122 | */ |
||
123 | private $chartData = ''; |
||
124 | |||
125 | /** |
||
126 | * Get percentage of returning users |
||
127 | * |
||
128 | * @return int |
||
129 | */ |
||
130 | public function getReturningUsersPercentage() |
||
131 | { |
||
132 | return $this->returningUsers ? round(($this->returningUsers / $this->sessions) * 100) : 0; |
||
133 | } |
||
134 | |||
135 | /** |
||
136 | * Get percentage of new users |
||
137 | * |
||
138 | * @return int |
||
139 | */ |
||
140 | public function getNewUsersPercentage() |
||
141 | { |
||
142 | return $this->newUsers ? round(($this->newUsers / $this->sessions) * 100) : 0; |
||
143 | } |
||
144 | |||
145 | /** |
||
146 | * Get config |
||
147 | * |
||
148 | * @return integer |
||
149 | */ |
||
150 | public function getConfig() |
||
151 | { |
||
152 | return $this->config; |
||
153 | } |
||
154 | |||
155 | /** |
||
156 | * Set config |
||
157 | * |
||
158 | * @param integer $config |
||
159 | * |
||
160 | * @return AnalyticsTopReferrals |
||
161 | */ |
||
162 | public function setConfig($config) |
||
163 | { |
||
164 | $this->config = $config; |
||
165 | |||
166 | return $this; |
||
167 | } |
||
168 | |||
169 | /** |
||
170 | * Get segment |
||
171 | * |
||
172 | * @return integer |
||
173 | */ |
||
174 | public function getSegment() |
||
175 | { |
||
176 | return $this->segment; |
||
177 | } |
||
178 | |||
179 | /** |
||
180 | * Set segment |
||
181 | * |
||
182 | * @param integer $segment |
||
183 | * |
||
184 | * @return AnalyticsTopReferrals |
||
185 | */ |
||
186 | public function setSegment($segment) |
||
187 | { |
||
188 | $this->segment = $segment; |
||
189 | |||
190 | return $this; |
||
191 | } |
||
192 | |||
193 | |||
194 | /** |
||
195 | * Set goals |
||
196 | * |
||
197 | * @param array $goals |
||
198 | * @return $this |
||
199 | */ |
||
200 | public function setGoals($goals) |
||
201 | { |
||
202 | $this->goals = $goals; |
||
203 | |||
204 | return $this; |
||
205 | } |
||
206 | |||
207 | /** |
||
208 | * Get goals |
||
209 | * |
||
210 | * @return AnalyticsGoal[] |
||
211 | */ |
||
212 | public function getGoals() |
||
213 | { |
||
214 | return $this->goals; |
||
215 | } |
||
216 | |||
217 | /** |
||
218 | * @return array |
||
219 | */ |
||
220 | public function getActiveGoals() |
||
221 | { |
||
222 | $goals = array(); |
||
223 | foreach ($this->getGoals() as $goal) { |
||
224 | if ($goal->getVisits()) $goals[] = $goal; |
||
225 | } |
||
226 | return $goals; |
||
227 | } |
||
228 | |||
229 | |||
230 | /** |
||
231 | * Set chartData |
||
232 | * |
||
233 | * @param array $chartData |
||
234 | * @return $this |
||
235 | */ |
||
236 | public function setChartData($chartData) |
||
237 | { |
||
238 | $this->chartData = $chartData; |
||
239 | |||
240 | return $this; |
||
241 | } |
||
242 | |||
243 | /** |
||
244 | * Get chartData |
||
245 | * |
||
246 | * @return array |
||
247 | */ |
||
248 | public function getChartData() |
||
249 | { |
||
250 | return $this->chartData; |
||
251 | } |
||
252 | |||
253 | /** |
||
254 | * Set newUsers |
||
255 | * |
||
256 | * @param float $newUsers |
||
257 | * @return AnalyticsOverview |
||
258 | */ |
||
259 | public function setNewUsers($newUsers) |
||
260 | { |
||
261 | $this->newUsers = $newUsers; |
||
262 | |||
263 | return $this; |
||
264 | } |
||
265 | |||
266 | /** |
||
267 | * Get newUsers |
||
268 | * |
||
269 | * @return float |
||
270 | */ |
||
271 | public function getNewUsers() |
||
272 | { |
||
273 | return $this->newUsers; |
||
274 | } |
||
275 | |||
276 | |||
277 | /** |
||
278 | * @param int $returningUsers |
||
279 | * @return $this |
||
280 | */ |
||
281 | public function setReturningUsers($returningUsers) |
||
282 | { |
||
283 | $this->returningUsers = $returningUsers; |
||
284 | |||
285 | return $this; |
||
286 | } |
||
287 | |||
288 | /** |
||
289 | * @return int |
||
290 | */ |
||
291 | public function getReturningUsers() |
||
292 | { |
||
293 | return $this->returningUsers; |
||
294 | } |
||
295 | |||
296 | |||
297 | /** |
||
298 | * Set title |
||
299 | * |
||
300 | * @param string $title |
||
301 | * @return AnalyticsOverview |
||
302 | */ |
||
303 | public function setTitle($title) |
||
304 | { |
||
305 | $this->title = $title; |
||
306 | |||
307 | return $this; |
||
308 | } |
||
309 | |||
310 | /** |
||
311 | * Get title |
||
312 | * |
||
313 | * @return string |
||
314 | */ |
||
315 | public function getTitle() |
||
316 | { |
||
317 | return $this->title; |
||
318 | } |
||
319 | |||
320 | /** |
||
321 | * Set startOffset |
||
322 | * |
||
323 | * @param integer $startOffset |
||
324 | * @return AnalyticsOverview |
||
325 | */ |
||
326 | public function setStartOffset($startOffset) |
||
327 | { |
||
328 | $this->startOffset = $startOffset; |
||
329 | |||
330 | return $this; |
||
331 | } |
||
332 | |||
333 | /** |
||
334 | * Get startOffset |
||
335 | * |
||
336 | * @return integer |
||
337 | */ |
||
338 | public function getStartOffset() |
||
339 | { |
||
340 | return $this->startOffset; |
||
341 | } |
||
342 | |||
343 | /** |
||
344 | * Set timespan |
||
345 | * |
||
346 | * @param integer $timespan |
||
347 | * @return AnalyticsOverview |
||
348 | */ |
||
349 | public function setTimespan($timespan) |
||
350 | { |
||
351 | $this->timespan = $timespan; |
||
352 | |||
353 | return $this; |
||
354 | } |
||
355 | |||
356 | /** |
||
357 | * Get timespan |
||
358 | * |
||
359 | * @return integer |
||
360 | */ |
||
361 | public function getTimespan() |
||
362 | { |
||
363 | return $this->timespan; |
||
364 | } |
||
365 | |||
366 | /** |
||
367 | * Set sessions |
||
368 | * |
||
369 | * @param integer $sessions |
||
370 | * @return AnalyticsOverview |
||
371 | */ |
||
372 | public function setSessions($sessions) |
||
373 | { |
||
374 | $this->sessions = $sessions; |
||
375 | |||
376 | return $this; |
||
377 | } |
||
378 | |||
379 | /** |
||
380 | * Get sessions |
||
381 | * |
||
382 | * @return integer |
||
383 | */ |
||
384 | public function getSessions() |
||
385 | { |
||
386 | return $this->sessions; |
||
387 | } |
||
388 | |||
389 | /** |
||
390 | * Get Users |
||
391 | * |
||
392 | * @return integer |
||
393 | */ |
||
394 | public function getUsers() |
||
395 | { |
||
396 | return $this->users; |
||
397 | } |
||
398 | |||
399 | /** |
||
400 | * Set users |
||
401 | * |
||
402 | * @param integer $users |
||
403 | * @return AnalyticsOverview |
||
404 | */ |
||
405 | public function setUsers($users) |
||
406 | { |
||
407 | $this->users = $users; |
||
408 | |||
409 | return $this; |
||
410 | } |
||
411 | |||
412 | /** |
||
413 | * Set pageviews |
||
414 | * |
||
415 | * @param integer $pageviews |
||
416 | * @return AnalyticsOverview |
||
417 | */ |
||
418 | public function setPageviews($pageviews) |
||
419 | { |
||
420 | $this->pageviews = $pageviews; |
||
421 | |||
422 | return $this; |
||
423 | } |
||
424 | |||
425 | /** |
||
426 | * Get pageviews |
||
427 | * |
||
428 | * @return integer |
||
429 | */ |
||
430 | public function getPageviews() |
||
431 | { |
||
432 | return $this->pageviews; |
||
433 | } |
||
434 | |||
435 | /** |
||
436 | * Set pagesPerSession |
||
437 | * |
||
438 | * @param float $pagesPerSession |
||
439 | * @return AnalyticsOverview |
||
440 | */ |
||
441 | public function setPagesPerSession($pagesPerSession) |
||
442 | { |
||
443 | $this->pagesPerSession = $pagesPerSession; |
||
444 | |||
445 | return $this; |
||
446 | } |
||
447 | |||
448 | /** |
||
449 | * Get pagesPerSession |
||
450 | * |
||
451 | * @return float |
||
452 | */ |
||
453 | public function getPagesPerSession() |
||
454 | { |
||
455 | return $this->pagesPerSession; |
||
456 | } |
||
457 | |||
458 | /** |
||
459 | * Set avgSessionDuration |
||
460 | * |
||
461 | * @param integer $avgSessionDuration |
||
462 | * @return AnalyticsOverview |
||
463 | */ |
||
464 | public function setAvgSessionDuration($avgSessionDuration) |
||
465 | { |
||
466 | $this->avgSessionDuration = $avgSessionDuration; |
||
0 ignored issues
–
show
|
|||
467 | |||
468 | return $this; |
||
469 | } |
||
470 | |||
471 | /** |
||
472 | * Get avgSessionDuration |
||
473 | * |
||
474 | * @return string |
||
475 | */ |
||
476 | public function getAvgSessionDuration() |
||
477 | { |
||
478 | return $this->avgSessionDuration; |
||
479 | } |
||
480 | |||
481 | /** |
||
482 | * Set useYear |
||
483 | * |
||
484 | * @param integer $useYear |
||
485 | * @return AnalyticsOverview |
||
486 | */ |
||
487 | public function setUseYear($useYear) |
||
488 | { |
||
489 | $this->useYear = $useYear; |
||
0 ignored issues
–
show
The property
$useYear was declared of type boolean , but $useYear is of type integer . Maybe add a type cast?
This check looks for assignments to scalar types that may be of the wrong type. To ensure the code behaves as expected, it may be a good idea to add an explicit type cast. $answer = 42;
$correct = false;
$correct = (bool) $answer;
Loading history...
|
|||
490 | |||
491 | return $this; |
||
492 | } |
||
493 | |||
494 | /** |
||
495 | * Get useYear |
||
496 | * |
||
497 | * @return integer |
||
498 | */ |
||
499 | public function getUseYear() |
||
500 | { |
||
501 | return $this->useYear; |
||
502 | } |
||
503 | |||
504 | /** |
||
505 | * Set chartDataMaxValue |
||
506 | * |
||
507 | * @param integer $chartDataMaxValue |
||
508 | * @return AnalyticsOverview |
||
509 | */ |
||
510 | public function setChartDataMaxValue($chartDataMaxValue) |
||
511 | { |
||
512 | $this->chartDataMaxValue = $chartDataMaxValue; |
||
513 | |||
514 | return $this; |
||
515 | } |
||
516 | |||
517 | /** |
||
518 | * Get chartDataMaxValue |
||
519 | * |
||
520 | * @return integer |
||
521 | */ |
||
522 | public function getChartDataMaxValue() |
||
523 | { |
||
524 | return $this->chartDataMaxValue; |
||
525 | } |
||
526 | } |
||
527 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.