Code Duplication    Length = 16-18 lines in 2 locations

engine/classes/Elgg/Database/EntityTable.php 1 location

@@ 1144-1161 (lines=18) @@
1141
	
1142
		if (is_array($subtype)) {
1143
			$tempwhere = "";
1144
			if (sizeof($subtype)) {
1145
				foreach ($subtype as $typekey => $subtypearray) {
1146
					foreach ($subtypearray as $subtypeval) {
1147
						$typekey = sanitise_string($typekey);
1148
						if (!empty($subtypeval)) {
1149
							if (!$subtypeval = (int) get_subtype_id($typekey, $subtypeval)) {
1150
								return false;
1151
							}
1152
						} else {
1153
							$subtypeval = 0;
1154
						}
1155
						if (!empty($tempwhere)) {
1156
							$tempwhere .= " or ";
1157
						}
1158
						$tempwhere .= "(type = '{$typekey}' and subtype = {$subtypeval})";
1159
					}
1160
				}
1161
			}
1162
			if (!empty($tempwhere)) {
1163
				$where[] = "({$tempwhere})";
1164
			}

engine/lib/deprecated-1.9.php 1 location

@@ 1427-1442 (lines=16) @@
1424
1425
	if (is_array($type)) {
1426
		$tempwhere = "";
1427
		if (sizeof($type)) {
1428
			foreach ($type as $typekey => $subtypearray) {
1429
				foreach ($subtypearray as $subtypeval) {
1430
					$typekey = sanitise_string($typekey);
1431
					if (!empty($subtypeval)) {
1432
						$subtypeval = (int) get_subtype_id($typekey, $subtypeval);
1433
					} else {
1434
						$subtypeval = 0;
1435
					}
1436
					if (!empty($tempwhere)) {
1437
						$tempwhere .= " or ";
1438
					}
1439
					$tempwhere .= "(e.type = '{$typekey}' and e.subtype = {$subtypeval})";
1440
				}
1441
			}
1442
		}
1443
		if (!empty($tempwhere)) {
1444
			$where[] = "({$tempwhere})";
1445
		}