Code Duplication    Length = 42-42 lines in 4 locations

statisticsplot.php 4 locations

@@ 1045-1086 (lines=42) @@
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;
1048
	$title             = /* I18N: Two axes of a graph */ I18N::translate('Longevity versus time');
1049
	$xtitle            = I18N::translate('age');
1050
	$ytitle            = I18N::translate('numbers');
1051
	$boundaries_x_axis = Filter::get('x-axis-boundaries-ages');
1052
	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1053
	calculate_axis($boundaries_x_axis);
1054
	if ($z_axis !== 300 && $z_axis !== 301) {
1055
		calculate_legend($boundaries_z_axis);
1056
	}
1057
	$percentage = false;
1058
	if ($y_axis === 201) {
1059
		$percentage = false;
1060
		$ytitle     = I18N::translate('Individuals');
1061
	} elseif ($y_axis === 202) {
1062
		$percentage = true;
1063
		$ytitle     = I18N::translate('percentage');
1064
	}
1065
	$male_female = false;
1066
	if ($z_axis === 300) {
1067
		$zgiven          = false;
1068
		$legend[0]       = 'all';
1069
		$zmax            = 1;
1070
		$z_boundaries[0] = 100000;
1071
	} elseif ($z_axis === 301) {
1072
		$male_female = true;
1073
		$zgiven      = true;
1074
		$legend[0]   = I18N::translate('Male');
1075
		$legend[1]   = I18N::translate('Female');
1076
		$zmax        = 2;
1077
	}
1078
	//-- reset the data array
1079
	for ($i = 0; $i < $zmax; $i++) {
1080
		for ($j = 0; $j < $xmax; $j++) {
1081
			$ydata[$i][$j] = 0;
1082
		}
1083
	}
1084
	$total = longevity_versus_time($z_axis, $z_boundaries, $stats);
1085
	my_plot($title, $xdata, $xtitle, $ydata, $ytitle, $legend);
1086
	break;
1087
case '19':
1088
	$xgiven            = false;
1089
	$zgiven            = false;
@@ 1087-1128 (lines=42) @@
1084
	$total = longevity_versus_time($z_axis, $z_boundaries, $stats);
1085
	my_plot($title, $xdata, $xtitle, $ydata, $ytitle, $legend);
1086
	break;
1087
case '19':
1088
	$xgiven            = false;
1089
	$zgiven            = false;
1090
	$title             = I18N::translate('Age in year of marriage');
1091
	$xtitle            = I18N::translate('age');
1092
	$ytitle            = I18N::translate('numbers');
1093
	$boundaries_x_axis = Filter::get('x-axis-boundaries-ages_m');
1094
	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1095
	calculate_axis($boundaries_x_axis);
1096
	if ($z_axis !== 300 && $z_axis !== 301) {
1097
		calculate_legend($boundaries_z_axis);
1098
	}
1099
	$percentage = false;
1100
	if ($y_axis === 201) {
1101
		$percentage = false;
1102
		$ytitle     = I18N::translate('Individuals');
1103
	} elseif ($y_axis === 202) {
1104
		$percentage = true;
1105
		$ytitle     = I18N::translate('percentage');
1106
	}
1107
	$male_female     = false;
1108
	$z_boundaries[0] = 100000;
1109
	if ($z_axis === 300) {
1110
		$zgiven    = false;
1111
		$legend[0] = 'all';
1112
		$zmax      = 1;
1113
	} elseif ($z_axis === 301) {
1114
		$male_female = true;
1115
		$zgiven      = true;
1116
		$legend[0]   = I18N::translate('Male');
1117
		$legend[1]   = I18N::translate('Female');
1118
		$zmax        = 2;
1119
	}
1120
	//-- reset the data array
1121
	for ($i = 0; $i < $zmax; $i++) {
1122
		for ($j = 0; $j < $xmax; $j++) {
1123
			$ydata[$i][$j] = 0;
1124
		}
1125
	}
1126
	$total = age_at_marriage($z_axis, $z_boundaries, $stats);
1127
	my_plot($title, $xdata, $xtitle, $ydata, $ytitle, $legend);
1128
	break;
1129
case '20':
1130
	$xgiven            = false;
1131
	$zgiven            = false;
@@ 1129-1170 (lines=42) @@
1126
	$total = age_at_marriage($z_axis, $z_boundaries, $stats);
1127
	my_plot($title, $xdata, $xtitle, $ydata, $ytitle, $legend);
1128
	break;
1129
case '20':
1130
	$xgiven            = false;
1131
	$zgiven            = false;
1132
	$title             = I18N::translate('Age in year of first marriage');
1133
	$xtitle            = I18N::translate('age');
1134
	$ytitle            = I18N::translate('numbers');
1135
	$boundaries_x_axis = Filter::get('x-axis-boundaries-ages_m');
1136
	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1137
	calculate_axis($boundaries_x_axis);
1138
	if ($z_axis !== 300 && $z_axis !== 301) {
1139
		calculate_legend($boundaries_z_axis);
1140
	}
1141
	$percentage = false;
1142
	if ($y_axis === 201) {
1143
		$percentage = false;
1144
		$ytitle     = I18N::translate('Individuals');
1145
	} elseif ($y_axis === 202) {
1146
		$percentage = true;
1147
		$ytitle     = I18N::translate('percentage');
1148
	}
1149
	$male_female = false;
1150
	if ($z_axis === 300) {
1151
		$zgiven          = false;
1152
		$legend[0]       = 'all';
1153
		$zmax            = 1;
1154
		$z_boundaries[0] = 100000;
1155
	} elseif ($z_axis === 301) {
1156
		$male_female = true;
1157
		$zgiven      = true;
1158
		$legend[0]   = I18N::translate('Male');
1159
		$legend[1]   = I18N::translate('Female');
1160
		$zmax        = 2;
1161
	}
1162
	//-- reset the data array
1163
	for ($i = 0; $i < $zmax; $i++) {
1164
		for ($j = 0; $j < $xmax; $j++) {
1165
			$ydata[$i][$j] = 0;
1166
		}
1167
	}
1168
	$total = age_at_first_marriage($z_axis, $z_boundaries, $stats);
1169
	my_plot($title, $xdata, $xtitle, $ydata, $ytitle, $legend);
1170
	break;
1171
case '21':
1172
	$xgiven            = false;
1173
	$zgiven            = false;
@@ 1171-1212 (lines=42) @@
1168
	$total = age_at_first_marriage($z_axis, $z_boundaries, $stats);
1169
	my_plot($title, $xdata, $xtitle, $ydata, $ytitle, $legend);
1170
	break;
1171
case '21':
1172
	$xgiven            = false;
1173
	$zgiven            = false;
1174
	$title             = I18N::translate('Number of children');
1175
	$xtitle            = I18N::translate('children');
1176
	$ytitle            = I18N::translate('numbers');
1177
	$boundaries_x_axis = Filter::get('x-axis-boundaries-numbers');
1178
	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1179
	calculate_axis($boundaries_x_axis);
1180
	if ($z_axis !== 300 && $z_axis !== 301) {
1181
		calculate_legend($boundaries_z_axis);
1182
	}
1183
	$percentage = false;
1184
	if ($y_axis === 201) {
1185
		$percentage = false;
1186
		$ytitle     = I18N::translate('Families');
1187
	} elseif ($y_axis === 202) {
1188
		$percentage = true;
1189
		$ytitle     = I18N::translate('percentage');
1190
	}
1191
	$male_female = false;
1192
	if ($z_axis === 300) {
1193
		$zgiven          = false;
1194
		$legend[0]       = 'all';
1195
		$zmax            = 1;
1196
		$z_boundaries[0] = 100000;
1197
	} elseif ($z_axis === 301) {
1198
		$male_female = true;
1199
		$zgiven      = true;
1200
		$legend[0]   = I18N::translate('Male');
1201
		$legend[1]   = I18N::translate('Female');
1202
		$zmax        = 2;
1203
	}
1204
	//-- reset the data array
1205
	for ($i = 0; $i < $zmax; $i++) {
1206
		for ($j = 0; $j < $xmax; $j++) {
1207
			$ydata[$i][$j] = 0;
1208
		}
1209
	}
1210
	$total = number_of_children($z_axis, $z_boundaries, $stats);
1211
	my_plot($title, $xdata, $xtitle, $ydata, $ytitle, $legend);
1212
	break;
1213
default:
1214
	break;
1215
}