src/Peach/Util/Arrays.php
private static function getTop(array $arr, Comparator $c = null, $isMax = false)
    {
        if (!isset($c)) {
            $c = DefaultComparator::getInstance();
        }
        $candidate = null;
        foreach ($arr as $current) {
            if (!isset($candidate)) {
                $candidate = $current;
                continue;
            }
            $comp = $c->compare($current, $candidate);
            if (($isMax && 0 < $comp) || (!$isMax && $comp < 0)) {
                $candidate = $current;
            }
        }
        return $candidate;
    }
private static function getTop(array $arr, Comparator $c = null, $isMax = false)
    {
        if (!isset($c)) {
            $c = DefaultComparator::getInstance();
        }
        $candidate = null;
        foreach ($arr as $current) {
            if (!isset($candidate)) {
                $candidate = $current;
                continue;
            }
            $comp = $c->compare($current, $candidate);
            if (($isMax && 0 < $comp) || (!$isMax && $comp < 0)) {
                $candidate = $current;
            }
        }
        return $candidate;
    }
{@link Arrays::max} と {@link Arrays::min} の共通部分の実装です.
@param  array      $arr
@param  Comparator $c
@param  bool       $isMax
@return mixed