Completed
Push — master ( 9e1ab8...e0f7b9 )
by Bill
04:14 queued 02:03
created

ResultCollection::orderByScoreDesc()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php declare(strict_types = 1);
2
3
namespace Churn\Results;
4
5
use Illuminate\Support\Collection;
6
7
class ResultCollection extends Collection
8
{
9
    /**
10
     * Order results by their score in descending order.
11
     * @return self
12
     */
13
    public function orderByScoreDesc(): self
14
    {
15
        return $this->sortByDesc(function ($result) {
16
            return $result->getScore();
17
        });
18
    }
19
}
20