Completed
Push — master ( a65aba...e33292 )
by Klochok
11:39
created

ServerSort   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 6
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 3
dl 0
loc 6
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A byServerName() 0 4 1
1
<?php
2
3
namespace hipanel\modules\server\helpers;
4
5
use hipanel\modules\server\models\Server;
6
use Tuck\Sort\Sort;
7
use Tuck\Sort\SortChain;
8
9
class ServerSort
10
{
11
    public static function byServerName(): SortChain
12
    {
13
        return Sort::chain()->compare(function (Server $a, Server $b) {
14
            return strnatcasecmp($a->name, $b->name);
15
        });
16
    }
17
}
18