Conditions | 106 |
Paths | 124 |
Total Lines | 519 |
Code Lines | 399 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
242 | public function postCustomChartAction(ServerRequestInterface $request): ResponseInterface |
||
243 | { |
||
244 | $statistics = app(Statistics::class); |
||
245 | assert($statistics instanceof Statistics); |
||
246 | |||
247 | $params = (array) $request->getParsedBody(); |
||
248 | |||
249 | $x_axis_type = (int) $params['x-as']; |
||
250 | $y_axis_type = (int) $params['y-as']; |
||
251 | $z_axis_type = (int) $params['z-as']; |
||
252 | $ydata = []; |
||
253 | |||
254 | switch ($x_axis_type) { |
||
255 | case self::X_AXIS_INDIVIDUAL_MAP: |
||
256 | return response($statistics->chartDistribution( |
||
257 | $params['chart_shows'], |
||
258 | $params['chart_type'], |
||
259 | $params['SURN'] |
||
260 | )); |
||
261 | |||
262 | case self::X_AXIS_BIRTH_MAP: |
||
263 | return response($statistics->chartDistribution( |
||
264 | $params['chart_shows'], |
||
265 | 'birth_distribution_chart' |
||
266 | )); |
||
267 | |||
268 | case self::X_AXIS_DEATH_MAP: |
||
269 | return response($statistics->chartDistribution( |
||
270 | $params['chart_shows'], |
||
271 | 'death_distribution_chart' |
||
272 | )); |
||
273 | |||
274 | case self::X_AXIS_MARRIAGE_MAP: |
||
275 | return response($statistics->chartDistribution( |
||
276 | $params['chart_shows'], |
||
277 | 'marriage_distribution_chart' |
||
278 | )); |
||
279 | |||
280 | case self::X_AXIS_BIRTH_MONTH: |
||
281 | $chart_title = I18N::translate('Month of birth'); |
||
282 | $x_axis_title = I18N::translate('Month'); |
||
283 | $x_axis = $this->axisMonths(); |
||
284 | |||
285 | switch ($y_axis_type) { |
||
286 | case self::Y_AXIS_NUMBERS: |
||
287 | $y_axis_title = I18N::translate('Individuals'); |
||
288 | break; |
||
289 | case self::Y_AXIS_PERCENT: |
||
290 | $y_axis_title = '%'; |
||
291 | break; |
||
292 | default: |
||
293 | throw new HttpNotFoundException(); |
||
294 | } |
||
295 | |||
296 | switch ($z_axis_type) { |
||
297 | case self::Z_AXIS_ALL: |
||
298 | $z_axis = $this->axisAll(); |
||
299 | $rows = $statistics->statsBirthQuery()->get(); |
||
300 | foreach ($rows as $row) { |
||
301 | $this->fillYData($row->d_month, 0, $row->total, $x_axis, $z_axis, $ydata); |
||
302 | } |
||
303 | break; |
||
304 | case self::Z_AXIS_SEX: |
||
305 | $z_axis = $this->axisSexes(); |
||
306 | $rows = $statistics->statsBirthBySexQuery()->get(); |
||
307 | foreach ($rows as $row) { |
||
308 | $this->fillYData($row->d_month, $row->i_sex, $row->total, $x_axis, $z_axis, $ydata); |
||
309 | } |
||
310 | break; |
||
311 | case self::Z_AXIS_TIME: |
||
312 | $boundaries_csv = $params['z-axis-boundaries-periods']; |
||
313 | $z_axis = $this->axisYears($boundaries_csv); |
||
314 | $prev_boundary = 0; |
||
315 | foreach (array_keys($z_axis) as $boundary) { |
||
316 | $rows = $statistics->statsBirthQuery($prev_boundary, $boundary)->get(); |
||
317 | foreach ($rows as $row) { |
||
318 | $this->fillYData($row->d_month, $boundary, $row->total, $x_axis, $z_axis, $ydata); |
||
319 | } |
||
320 | $prev_boundary = $boundary + 1; |
||
321 | } |
||
322 | break; |
||
323 | default: |
||
324 | throw new HttpNotFoundException(); |
||
325 | } |
||
326 | |||
327 | return response($this->myPlot($chart_title, $x_axis, $x_axis_title, $ydata, $y_axis_title, $z_axis, $y_axis_type)); |
||
328 | |||
329 | case self::X_AXIS_DEATH_MONTH: |
||
330 | $chart_title = I18N::translate('Month of death'); |
||
331 | $x_axis_title = I18N::translate('Month'); |
||
332 | $x_axis = $this->axisMonths(); |
||
333 | |||
334 | switch ($y_axis_type) { |
||
335 | case self::Y_AXIS_NUMBERS: |
||
336 | $y_axis_title = I18N::translate('Individuals'); |
||
337 | break; |
||
338 | case self::Y_AXIS_PERCENT: |
||
339 | $y_axis_title = '%'; |
||
340 | break; |
||
341 | default: |
||
342 | throw new HttpNotFoundException(); |
||
343 | } |
||
344 | |||
345 | switch ($z_axis_type) { |
||
346 | case self::Z_AXIS_ALL: |
||
347 | $z_axis = $this->axisAll(); |
||
348 | $rows = $statistics->statsDeathQuery()->get(); |
||
349 | foreach ($rows as $row) { |
||
350 | $this->fillYData($row->d_month, 0, $row->total, $x_axis, $z_axis, $ydata); |
||
351 | } |
||
352 | break; |
||
353 | case self::Z_AXIS_SEX: |
||
354 | $z_axis = $this->axisSexes(); |
||
355 | $rows = $statistics->statsDeathBySexQuery()->get(); |
||
356 | foreach ($rows as $row) { |
||
357 | $this->fillYData($row->d_month, $row->i_sex, $row->total, $x_axis, $z_axis, $ydata); |
||
358 | } |
||
359 | break; |
||
360 | case self::Z_AXIS_TIME: |
||
361 | $boundaries_csv = $params['z-axis-boundaries-periods']; |
||
362 | $z_axis = $this->axisYears($boundaries_csv); |
||
363 | $prev_boundary = 0; |
||
364 | foreach (array_keys($z_axis) as $boundary) { |
||
365 | $rows = $statistics->statsDeathQuery($prev_boundary, $boundary)->get(); |
||
366 | foreach ($rows as $row) { |
||
367 | $this->fillYData($row->d_month, $boundary, $row->total, $x_axis, $z_axis, $ydata); |
||
368 | } |
||
369 | $prev_boundary = $boundary + 1; |
||
370 | } |
||
371 | break; |
||
372 | default: |
||
373 | throw new HttpNotFoundException(); |
||
374 | } |
||
375 | |||
376 | return response($this->myPlot($chart_title, $x_axis, $x_axis_title, $ydata, $y_axis_title, $z_axis, $y_axis_type)); |
||
377 | |||
378 | case self::X_AXIS_MARRIAGE_MONTH: |
||
379 | $chart_title = I18N::translate('Month of marriage'); |
||
380 | $x_axis_title = I18N::translate('Month'); |
||
381 | $x_axis = $this->axisMonths(); |
||
382 | |||
383 | switch ($y_axis_type) { |
||
384 | case self::Y_AXIS_NUMBERS: |
||
385 | $y_axis_title = I18N::translate('Families'); |
||
386 | break; |
||
387 | case self::Y_AXIS_PERCENT: |
||
388 | $y_axis_title = '%'; |
||
389 | break; |
||
390 | default: |
||
391 | throw new HttpNotFoundException(); |
||
392 | } |
||
393 | |||
394 | switch ($z_axis_type) { |
||
395 | case self::Z_AXIS_ALL: |
||
396 | $z_axis = $this->axisAll(); |
||
397 | $rows = $statistics->statsMarriageQuery()->get(); |
||
398 | foreach ($rows as $row) { |
||
399 | $this->fillYData($row->d_month, 0, $row->total, $x_axis, $z_axis, $ydata); |
||
400 | } |
||
401 | break; |
||
402 | case self::Z_AXIS_TIME: |
||
403 | $boundaries_csv = $params['z-axis-boundaries-periods']; |
||
404 | $z_axis = $this->axisYears($boundaries_csv); |
||
405 | $prev_boundary = 0; |
||
406 | foreach (array_keys($z_axis) as $boundary) { |
||
407 | $rows = $statistics->statsMarriageQuery($prev_boundary, $boundary)->get(); |
||
408 | foreach ($rows as $row) { |
||
409 | $this->fillYData($row->d_month, $boundary, $row->total, $x_axis, $z_axis, $ydata); |
||
410 | } |
||
411 | $prev_boundary = $boundary + 1; |
||
412 | } |
||
413 | break; |
||
414 | default: |
||
415 | throw new HttpNotFoundException(); |
||
416 | } |
||
417 | |||
418 | return response($this->myPlot($chart_title, $x_axis, $x_axis_title, $ydata, $y_axis_title, $z_axis, $y_axis_type)); |
||
419 | |||
420 | case self::X_AXIS_FIRST_CHILD_MONTH: |
||
421 | $chart_title = I18N::translate('Month of birth of first child in a relation'); |
||
422 | $x_axis_title = I18N::translate('Month'); |
||
423 | $x_axis = $this->axisMonths(); |
||
424 | |||
425 | switch ($y_axis_type) { |
||
426 | case self::Y_AXIS_NUMBERS: |
||
427 | $y_axis_title = I18N::translate('Children'); |
||
428 | break; |
||
429 | case self::Y_AXIS_PERCENT: |
||
430 | $y_axis_title = '%'; |
||
431 | break; |
||
432 | default: |
||
433 | throw new HttpNotFoundException(); |
||
434 | } |
||
435 | |||
436 | switch ($z_axis_type) { |
||
437 | case self::Z_AXIS_ALL: |
||
438 | $z_axis = $this->axisAll(); |
||
439 | $rows = $statistics->monthFirstChildQuery()->get(); |
||
440 | foreach ($rows as $row) { |
||
441 | $this->fillYData($row->d_month, 0, $row->total, $x_axis, $z_axis, $ydata); |
||
442 | } |
||
443 | break; |
||
444 | case self::Z_AXIS_SEX: |
||
445 | $z_axis = $this->axisSexes(); |
||
446 | $rows = $statistics->monthFirstChildBySexQuery()->get(); |
||
447 | foreach ($rows as $row) { |
||
448 | $this->fillYData($row->d_month, $row->i_sex, $row->total, $x_axis, $z_axis, $ydata); |
||
449 | } |
||
450 | break; |
||
451 | case self::Z_AXIS_TIME: |
||
452 | $boundaries_csv = $params['z-axis-boundaries-periods']; |
||
453 | $z_axis = $this->axisYears($boundaries_csv); |
||
454 | $prev_boundary = 0; |
||
455 | foreach (array_keys($z_axis) as $boundary) { |
||
456 | $rows = $statistics->monthFirstChildQuery($prev_boundary, $boundary)->get(); |
||
457 | foreach ($rows as $row) { |
||
458 | $this->fillYData($row->d_month, $boundary, $row->total, $x_axis, $z_axis, $ydata); |
||
459 | } |
||
460 | $prev_boundary = $boundary + 1; |
||
461 | } |
||
462 | break; |
||
463 | default: |
||
464 | throw new HttpNotFoundException(); |
||
465 | } |
||
466 | |||
467 | return response($this->myPlot($chart_title, $x_axis, $x_axis_title, $ydata, $y_axis_title, $z_axis, $y_axis_type)); |
||
468 | |||
469 | case self::X_AXIS_FIRST_MARRIAGE_MONTH: |
||
470 | $chart_title = I18N::translate('Month of first marriage'); |
||
471 | $x_axis_title = I18N::translate('Month'); |
||
472 | $x_axis = $this->axisMonths(); |
||
473 | |||
474 | switch ($y_axis_type) { |
||
475 | case self::Y_AXIS_NUMBERS: |
||
476 | $y_axis_title = I18N::translate('Families'); |
||
477 | break; |
||
478 | case self::Y_AXIS_PERCENT: |
||
479 | $y_axis_title = '%'; |
||
480 | break; |
||
481 | default: |
||
482 | throw new HttpNotFoundException(); |
||
483 | } |
||
484 | |||
485 | switch ($z_axis_type) { |
||
486 | case self::Z_AXIS_ALL: |
||
487 | $z_axis = $this->axisAll(); |
||
488 | $rows = $statistics->statsFirstMarriageQuery()->get(); |
||
489 | $indi = []; |
||
490 | foreach ($rows as $row) { |
||
491 | if (!in_array($row->f_husb, $indi, true) && !in_array($row->f_wife, $indi, true)) { |
||
492 | $this->fillYData($row->month, 0, 1, $x_axis, $z_axis, $ydata); |
||
493 | } |
||
494 | $indi[] = $row->f_husb; |
||
495 | $indi[] = $row->f_wife; |
||
496 | } |
||
497 | break; |
||
498 | case self::Z_AXIS_TIME: |
||
499 | $boundaries_csv = $params['z-axis-boundaries-periods']; |
||
500 | $z_axis = $this->axisYears($boundaries_csv); |
||
501 | $prev_boundary = 0; |
||
502 | $indi = []; |
||
503 | foreach (array_keys($z_axis) as $boundary) { |
||
504 | $rows = $statistics->statsFirstMarriageQuery($prev_boundary, $boundary)->get(); |
||
505 | foreach ($rows as $row) { |
||
506 | if (!in_array($row->f_husb, $indi, true) && !in_array($row->f_wife, $indi, true)) { |
||
507 | $this->fillYData($row->month, $boundary, 1, $x_axis, $z_axis, $ydata); |
||
508 | } |
||
509 | $indi[] = $row->f_husb; |
||
510 | $indi[] = $row->f_wife; |
||
511 | } |
||
512 | $prev_boundary = $boundary + 1; |
||
513 | } |
||
514 | break; |
||
515 | default: |
||
516 | throw new HttpNotFoundException(); |
||
517 | } |
||
518 | |||
519 | return response($this->myPlot($chart_title, $x_axis, $x_axis_title, $ydata, $y_axis_title, $z_axis, $y_axis_type)); |
||
520 | |||
521 | case self::X_AXIS_AGE_AT_DEATH: |
||
522 | $chart_title = I18N::translate('Average age at death'); |
||
523 | $x_axis_title = I18N::translate('age'); |
||
524 | $boundaries_csv = $params['x-axis-boundaries-ages']; |
||
525 | $x_axis = $this->axisNumbers($boundaries_csv); |
||
526 | |||
527 | switch ($y_axis_type) { |
||
528 | case self::Y_AXIS_NUMBERS: |
||
529 | $y_axis_title = I18N::translate('Individuals'); |
||
530 | break; |
||
531 | case self::Y_AXIS_PERCENT: |
||
532 | $y_axis_title = '%'; |
||
533 | break; |
||
534 | default: |
||
535 | throw new HttpNotFoundException(); |
||
536 | } |
||
537 | |||
538 | switch ($z_axis_type) { |
||
539 | case self::Z_AXIS_ALL: |
||
540 | $z_axis = $this->axisAll(); |
||
541 | $rows = $statistics->statsAgeQuery('DEAT'); |
||
542 | foreach ($rows as $row) { |
||
543 | foreach ($row as $age) { |
||
544 | $years = (int) ($age / self::DAYS_IN_YEAR); |
||
545 | $this->fillYData($years, 0, 1, $x_axis, $z_axis, $ydata); |
||
546 | } |
||
547 | } |
||
548 | break; |
||
549 | case self::Z_AXIS_SEX: |
||
550 | $z_axis = $this->axisSexes(); |
||
551 | foreach (array_keys($z_axis) as $sex) { |
||
552 | $rows = $statistics->statsAgeQuery('DEAT', $sex); |
||
553 | foreach ($rows as $row) { |
||
554 | foreach ($row as $age) { |
||
555 | $years = (int) ($age / self::DAYS_IN_YEAR); |
||
556 | $this->fillYData($years, $sex, 1, $x_axis, $z_axis, $ydata); |
||
557 | } |
||
558 | } |
||
559 | } |
||
560 | break; |
||
561 | case self::Z_AXIS_TIME: |
||
562 | $boundaries_csv = $params['z-axis-boundaries-periods']; |
||
563 | $z_axis = $this->axisYears($boundaries_csv); |
||
564 | $prev_boundary = 0; |
||
565 | foreach (array_keys($z_axis) as $boundary) { |
||
566 | $rows = $statistics->statsAgeQuery('DEAT', 'BOTH', $prev_boundary, $boundary); |
||
567 | foreach ($rows as $row) { |
||
568 | foreach ($row as $age) { |
||
569 | $years = (int) ($age / self::DAYS_IN_YEAR); |
||
570 | $this->fillYData($years, $boundary, 1, $x_axis, $z_axis, $ydata); |
||
571 | } |
||
572 | } |
||
573 | $prev_boundary = $boundary + 1; |
||
574 | } |
||
575 | |||
576 | break; |
||
577 | default: |
||
578 | throw new HttpNotFoundException(); |
||
579 | } |
||
580 | |||
581 | return response($this->myPlot($chart_title, $x_axis, $x_axis_title, $ydata, $y_axis_title, $z_axis, $y_axis_type)); |
||
582 | |||
583 | case self::X_AXIS_AGE_AT_MARRIAGE: |
||
584 | $chart_title = I18N::translate('Age in year of marriage'); |
||
585 | $x_axis_title = I18N::translate('age'); |
||
586 | $boundaries_csv = $params['x-axis-boundaries-ages_m']; |
||
587 | $x_axis = $this->axisNumbers($boundaries_csv); |
||
588 | |||
589 | switch ($y_axis_type) { |
||
590 | case self::Y_AXIS_NUMBERS: |
||
591 | $y_axis_title = I18N::translate('Individuals'); |
||
592 | break; |
||
593 | case self::Y_AXIS_PERCENT: |
||
594 | $y_axis_title = '%'; |
||
595 | break; |
||
596 | default: |
||
597 | throw new HttpNotFoundException(); |
||
598 | } |
||
599 | |||
600 | switch ($z_axis_type) { |
||
601 | case self::Z_AXIS_ALL: |
||
602 | $z_axis = $this->axisAll(); |
||
603 | // The stats query doesn't have an "all" function, so query M/F separately |
||
604 | foreach (['M', 'F'] as $sex) { |
||
605 | $rows = $statistics->statsMarrAgeQuery($sex); |
||
606 | foreach ($rows as $row) { |
||
607 | $years = (int) ($row->age / self::DAYS_IN_YEAR); |
||
608 | $this->fillYData($years, 0, 1, $x_axis, $z_axis, $ydata); |
||
609 | } |
||
610 | } |
||
611 | break; |
||
612 | case self::Z_AXIS_SEX: |
||
613 | $z_axis = $this->axisSexes(); |
||
614 | foreach (array_keys($z_axis) as $sex) { |
||
615 | $rows = $statistics->statsMarrAgeQuery($sex); |
||
616 | foreach ($rows as $row) { |
||
617 | $years = (int) ($row->age / self::DAYS_IN_YEAR); |
||
618 | $this->fillYData($years, $sex, 1, $x_axis, $z_axis, $ydata); |
||
619 | } |
||
620 | } |
||
621 | break; |
||
622 | case self::Z_AXIS_TIME: |
||
623 | $boundaries_csv = $params['z-axis-boundaries-periods']; |
||
624 | $z_axis = $this->axisYears($boundaries_csv); |
||
625 | // The stats query doesn't have an "all" function, so query M/F separately |
||
626 | foreach (['M', 'F'] as $sex) { |
||
627 | $prev_boundary = 0; |
||
628 | foreach (array_keys($z_axis) as $boundary) { |
||
629 | $rows = $statistics->statsMarrAgeQuery($sex, $prev_boundary, $boundary); |
||
630 | foreach ($rows as $row) { |
||
631 | $years = (int) ($row->age / self::DAYS_IN_YEAR); |
||
632 | $this->fillYData($years, $boundary, 1, $x_axis, $z_axis, $ydata); |
||
633 | } |
||
634 | $prev_boundary = $boundary + 1; |
||
635 | } |
||
636 | } |
||
637 | break; |
||
638 | default: |
||
639 | throw new HttpNotFoundException(); |
||
640 | } |
||
641 | |||
642 | return response($this->myPlot($chart_title, $x_axis, $x_axis_title, $ydata, $y_axis_title, $z_axis, $y_axis_type)); |
||
643 | |||
644 | case self::X_AXIS_AGE_AT_FIRST_MARRIAGE: |
||
645 | $chart_title = I18N::translate('Age in year of first marriage'); |
||
646 | $x_axis_title = I18N::translate('age'); |
||
647 | $boundaries_csv = $params['x-axis-boundaries-ages_m']; |
||
648 | $x_axis = $this->axisNumbers($boundaries_csv); |
||
649 | |||
650 | switch ($y_axis_type) { |
||
651 | case self::Y_AXIS_NUMBERS: |
||
652 | $y_axis_title = I18N::translate('Individuals'); |
||
653 | break; |
||
654 | case self::Y_AXIS_PERCENT: |
||
655 | $y_axis_title = '%'; |
||
656 | break; |
||
657 | default: |
||
658 | throw new HttpNotFoundException(); |
||
659 | } |
||
660 | |||
661 | switch ($z_axis_type) { |
||
662 | case self::Z_AXIS_ALL: |
||
663 | $z_axis = $this->axisAll(); |
||
664 | // The stats query doesn't have an "all" function, so query M/F separately |
||
665 | foreach (['M', 'F'] as $sex) { |
||
666 | $rows = $statistics->statsMarrAgeQuery($sex); |
||
667 | $indi = []; |
||
668 | foreach ($rows as $row) { |
||
669 | if (!in_array($row->d_gid, $indi, true)) { |
||
670 | $years = (int) ($row->age / self::DAYS_IN_YEAR); |
||
671 | $this->fillYData($years, 0, 1, $x_axis, $z_axis, $ydata); |
||
672 | $indi[] = $row->d_gid; |
||
673 | } |
||
674 | } |
||
675 | } |
||
676 | break; |
||
677 | case self::Z_AXIS_SEX: |
||
678 | $z_axis = $this->axisSexes(); |
||
679 | foreach (array_keys($z_axis) as $sex) { |
||
680 | $rows = $statistics->statsMarrAgeQuery($sex); |
||
681 | $indi = []; |
||
682 | foreach ($rows as $row) { |
||
683 | if (!in_array($row->d_gid, $indi, true)) { |
||
684 | $years = (int) ($row->age / self::DAYS_IN_YEAR); |
||
685 | $this->fillYData($years, $sex, 1, $x_axis, $z_axis, $ydata); |
||
686 | $indi[] = $row->d_gid; |
||
687 | } |
||
688 | } |
||
689 | } |
||
690 | break; |
||
691 | case self::Z_AXIS_TIME: |
||
692 | $boundaries_csv = $params['z-axis-boundaries-periods']; |
||
693 | $z_axis = $this->axisYears($boundaries_csv); |
||
694 | // The stats query doesn't have an "all" function, so query M/F separately |
||
695 | foreach (['M', 'F'] as $sex) { |
||
696 | $prev_boundary = 0; |
||
697 | $indi = []; |
||
698 | foreach (array_keys($z_axis) as $boundary) { |
||
699 | $rows = $statistics->statsMarrAgeQuery($sex, $prev_boundary, $boundary); |
||
700 | foreach ($rows as $row) { |
||
701 | if (!in_array($row->d_gid, $indi, true)) { |
||
702 | $years = (int) ($row->age / self::DAYS_IN_YEAR); |
||
703 | $this->fillYData($years, $boundary, 1, $x_axis, $z_axis, $ydata); |
||
704 | $indi[] = $row->d_gid; |
||
705 | } |
||
706 | } |
||
707 | $prev_boundary = $boundary + 1; |
||
708 | } |
||
709 | } |
||
710 | break; |
||
711 | default: |
||
712 | throw new HttpNotFoundException(); |
||
713 | } |
||
714 | |||
715 | return response($this->myPlot($chart_title, $x_axis, $x_axis_title, $ydata, $y_axis_title, $z_axis, $y_axis_type)); |
||
716 | |||
717 | case self::X_AXIS_NUMBER_OF_CHILDREN: |
||
718 | $chart_title = I18N::translate('Number of children'); |
||
719 | $x_axis_title = I18N::translate('Children'); |
||
720 | $x_axis = $this->axisNumbers('0,1,2,3,4,5,6,7,8,9,10'); |
||
721 | |||
722 | switch ($y_axis_type) { |
||
723 | case self::Y_AXIS_NUMBERS: |
||
724 | $y_axis_title = I18N::translate('Families'); |
||
725 | break; |
||
726 | case self::Y_AXIS_PERCENT: |
||
727 | $y_axis_title = '%'; |
||
728 | break; |
||
729 | default: |
||
730 | throw new HttpNotFoundException(); |
||
731 | } |
||
732 | |||
733 | switch ($z_axis_type) { |
||
734 | case self::Z_AXIS_ALL: |
||
735 | $z_axis = $this->axisAll(); |
||
736 | $rows = $statistics->statsChildrenQuery(); |
||
737 | foreach ($rows as $row) { |
||
738 | $this->fillYData($row->f_numchil, 0, $row->total, $x_axis, $z_axis, $ydata); |
||
739 | } |
||
740 | break; |
||
741 | case self::Z_AXIS_TIME: |
||
742 | $boundaries_csv = $params['z-axis-boundaries-periods']; |
||
743 | $z_axis = $this->axisYears($boundaries_csv); |
||
744 | $prev_boundary = 0; |
||
745 | foreach (array_keys($z_axis) as $boundary) { |
||
746 | $rows = $statistics->statsChildrenQuery($prev_boundary, $boundary); |
||
747 | foreach ($rows as $row) { |
||
748 | $this->fillYData($row->f_numchil, $boundary, $row->total, $x_axis, $z_axis, $ydata); |
||
749 | } |
||
750 | $prev_boundary = $boundary + 1; |
||
751 | } |
||
752 | break; |
||
753 | default: |
||
754 | throw new HttpNotFoundException(); |
||
755 | } |
||
756 | |||
757 | return response($this->myPlot($chart_title, $x_axis, $x_axis_title, $ydata, $y_axis_title, $z_axis, $y_axis_type)); |
||
758 | |||
759 | default: |
||
760 | throw new HttpNotFoundException(); |
||
761 | } |
||
1038 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.