@@ 567-578 (lines=12) @@ | ||
564 | } |
|
565 | } |
|
566 | ||
567 | public function maximum(callable $function = null) |
|
568 | { |
|
569 | $max = null; |
|
570 | ||
571 | foreach ($this->mapIterator($function) as $value) { |
|
572 | if ($value > $max) { |
|
573 | $max = $value; |
|
574 | } |
|
575 | } |
|
576 | ||
577 | return $max; |
|
578 | } |
|
579 | ||
580 | public function minimum(callable $function = null) |
|
581 | { |
|
@@ 595-604 (lines=10) @@ | ||
592 | return $min; |
|
593 | } |
|
594 | ||
595 | public function sum(callable $function = null) |
|
596 | { |
|
597 | $sum = null; |
|
598 | ||
599 | foreach ($this->mapIterator($function) as $value) { |
|
600 | $sum += $value; |
|
601 | } |
|
602 | ||
603 | return $sum; |
|
604 | } |
|
605 | ||
606 | public function average(callable $function = null) |
|
607 | { |