src/ArrayObject.php
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);
		}
	}
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);
		}
	}
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 ) ; } }
Internal sort function

@param array $array the array on which is operated on
@param Comparator|callable $cmp the compare function
@param callable $usort the sort function for user passed $cmd
@param callable $sort the default sort function
Internal sort function