Completed
Push — master ( 393329...74ff7b )
by Tomáš
10:49
created

SniffSorter   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 18
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A sort() 0 11 1
1
<?php
2
3
/*
4
 * This file is part of Symplify
5
 * Copyright (c) 2016 Tomas Votruba (http://tomasvotruba.cz).
6
 */
7
8
namespace Symplify\PHP7_CodeSniffer\Sniff\Sorter;
9
10
use PHP_CodeSniffer\Sniffs\Sniff;
11
12
final class SniffSorter
13
{
14
    /**
15
     * @param Sniff[] $sniffs
16
     * @return Sniff[]
17
     */
18
    public static function sort(array $sniffs) : array
19
    {
20 8
        usort($sniffs, function ($oneSniff, $otherSniff) {
21 6
            return strcmp(
22
                get_class($oneSniff),
23
                get_class($otherSniff)
24
            );
25 8
        });
26
27 8
        return $sniffs;
28
    }
29
}
30