Code Duplication    Length = 18-18 lines in 2 locations

mod/elgg_solr/lib/functions.php 2 locations

@@ 940-957 (lines=18) @@
937
				);
938
			}
939
			break;
940
		case 'day':
941
			for ($i = 0; $i < 24; $i++) {
942
				$starttime = mktime($i, 0, 0, date('m', $time), date('j', $time), date('Y', $time));
943
				$endtime = mktime($i + 1, 0, 0, date('m', $time), date('j', $time), date('Y', $time)) - 1;
944
945
				$fq['time_created'] = "time_created:[{$starttime} TO {$endtime}]";
946
				$indexed = elgg_solr_get_indexed_count("type:{$type}", $fq);
947
				$system = elgg_solr_get_system_count($options, $starttime, $endtime);
948
949
				$stats[date('H', $starttime)] = array(
950
					'count' => $system,
951
					'indexed' => $indexed,
952
					'starttime' => $starttime,
953
					'endtime' => $endtime,
954
					'block' => 'hour'
955
				);
956
			}
957
			break;
958
		case 'month':
959
			for ($i = 1; $i < date('t', $time) + 1; $i++) {
960
				$starttime = mktime(0, 0, 0, date('m', $time), $i, date('Y', $time));
@@ 958-975 (lines=18) @@
955
				);
956
			}
957
			break;
958
		case 'month':
959
			for ($i = 1; $i < date('t', $time) + 1; $i++) {
960
				$starttime = mktime(0, 0, 0, date('m', $time), $i, date('Y', $time));
961
				$endtime = mktime(0, 0, 0, date('m', $time), $i + 1, date('Y', $time)) - 1;
962
963
				$fq['time_created'] = "time_created:[{$starttime} TO {$endtime}]";
964
				$indexed = elgg_solr_get_indexed_count("type:{$type}", $fq);
965
				$system = elgg_solr_get_system_count($options, $starttime, $endtime);
966
967
				$stats[date('d', $starttime)] = array(
968
					'count' => $system,
969
					'indexed' => $indexed,
970
					'starttime' => $starttime,
971
					'endtime' => $endtime,
972
					'block' => 'day'
973
				);
974
			}
975
			break;
976
		case 'year':
977
			for ($i = 1; $i < 13; $i++) {
978
				$starttime = mktime(0, 0, 0, $i, 1, date('Y', $time));