protected function doSort(&$array, $cmp, callable $usort, callable $sort) {
		if (is_callable($cmp)) {
			$usort($array, $cmp);
		} else if ($cmp instanceof Comparator) {
			$usort($array, function ($a, $b) use ($cmp) {
				return $cmp->compare($a, $b);
			});
		} else {
			$sort($array);
		}
	}