Skip to content

Commit

Permalink
Simpler return for median method
Browse files Browse the repository at this point in the history
  • Loading branch information
Iandenh committed Jul 27, 2017
1 parent 593bece commit beda674
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Collection/CollectionTrait.php
Expand Up @@ -236,9 +236,7 @@ public function median($matcher = null)
return $values[$middle];
}

return (new static([
$values[$middle - 1], $values[$middle],
]))->avg();
return ($values[$middle - 1] + $values[$middle]) / 2;
}

/**
Expand Down

0 comments on commit beda674

Please sign in to comment.