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

ServerSort::byServerName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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