Code Duplication    Length = 50-50 lines in 2 locations

statisticsplot.php 2 locations

@@ 899-948 (lines=50) @@
896
		$total = month_of_death($z_axis, $z_boundaries, $stats);
897
		my_plot($title, $xdata, $xtitle, $ydata, $ytitle, $legend);
898
		break;
899
	case '13':
900
		$monthdata = [];
901
		for ($i = 0; $i < 12; ++$i) {
902
			$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
903
		}
904
905
		if ($z_axis === 301) {
906
			$z_axis = 300;
907
		}
908
		$xgiven            = true;
909
		$zgiven            = false;
910
		$title             = I18N::translate('Month of marriage');
911
		$xtitle            = I18N::translate('Month');
912
		$ytitle            = I18N::translate('numbers');
913
		$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
914
		$xdata             = $monthdata;
915
		$xmax              = 12;
916
		if ($z_axis !== 300 && $z_axis !== 301) {
917
			calculate_legend($boundaries_z_axis);
918
		}
919
		$percentage = false;
920
		if ($y_axis === 201) {
921
			$percentage = false;
922
			$ytitle     = I18N::translate('Families');
923
		} elseif ($y_axis === 202) {
924
			$percentage = true;
925
			$ytitle     = I18N::translate('percentage');
926
		}
927
		$male_female = false;
928
		if ($z_axis === 300) {
929
			$zgiven          = false;
930
			$legend[0]       = 'all';
931
			$zmax            = 1;
932
			$z_boundaries[0] = 100000;
933
		} elseif ($z_axis === 301) {
934
			$male_female = true;
935
			$zgiven      = true;
936
			$legend[0]   = I18N::translate('Male');
937
			$legend[1]   = I18N::translate('Female');
938
			$zmax        = 2;
939
		}
940
		//-- reset the data array
941
		for ($i = 0; $i < $zmax; $i++) {
942
			for ($j = 0; $j < $xmax; $j++) {
943
				$ydata[$i][$j] = 0;
944
			}
945
		}
946
		$total = month_of_marriage($z_axis, $z_boundaries, $stats);
947
		my_plot($title, $xdata, $xtitle, $ydata, $ytitle, $legend);
948
		break;
949
	case '14':
950
		$monthdata = [];
951
		for ($i = 0; $i < 12; ++$i) {
@@ 995-1044 (lines=50) @@
992
		$total = month_of_birth_of_first_child($z_axis, $z_boundaries, $stats);
993
		my_plot($title, $xdata, $xtitle, $ydata, $ytitle, $legend);
994
		break;
995
	case '15':
996
		$monthdata = [];
997
		for ($i = 0; $i < 12; ++$i) {
998
			$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
999
		}
1000
1001
		if ($z_axis === 301) {
1002
			$z_axis = 300;
1003
		}
1004
		$xgiven            = true;
1005
		$zgiven            = false;
1006
		$title             = I18N::translate('Month of first marriage');
1007
		$xtitle            = I18N::translate('Month');
1008
		$ytitle            = I18N::translate('numbers');
1009
		$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1010
		$xdata             = $monthdata;
1011
		$xmax              = 12;
1012
		if ($z_axis !== 300 && $z_axis !== 301) {
1013
			calculate_legend($boundaries_z_axis);
1014
		}
1015
		$percentage = false;
1016
		if ($y_axis === 201) {
1017
			$percentage = false;
1018
			$ytitle     = I18N::translate('Families');
1019
		} elseif ($y_axis === 202) {
1020
			$percentage = true;
1021
			$ytitle     = I18N::translate('percentage');
1022
		}
1023
		$male_female = false;
1024
		if ($z_axis === 300) {
1025
			$zgiven          = false;
1026
			$legend[0]       = 'all';
1027
			$zmax            = 1;
1028
			$z_boundaries[0] = 100000;
1029
		} elseif ($z_axis === 301) {
1030
			$male_female = true;
1031
			$zgiven      = true;
1032
			$legend[0]   = I18N::translate('Male');
1033
			$legend[1]   = I18N::translate('Female');
1034
			$zmax        = 2;
1035
		}
1036
		//-- reset the data array
1037
		for ($i = 0; $i < $zmax; $i++) {
1038
			for ($j = 0; $j < $xmax; $j++) {
1039
				$ydata[$i][$j] = 0;
1040
			}
1041
		}
1042
		$total = month_of_first_marriage($z_axis, $z_boundaries, $stats);
1043
		my_plot($title, $xdata, $xtitle, $ydata, $ytitle, $legend);
1044
		break;
1045
	case '18':
1046
		$xgiven            = false;
1047
		$zgiven            = false;