Completed
Push — master ( 520f00...657555 )
by Julien
02:13
created

VersionSorter   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 19
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 semver/semver.
5
 *
6
 * (c) SemVer <https://github.com/git-pull-request>
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace SemVer\SemVer;
15
16
/**
17
 * Sort multiple Version objects.
18
 */
19
final class VersionSorter
20
{
21
    /**
22
     * @param array $versions
23
     *
24
     * @return array
25
     */
26
    public static function sort(array $versions) : array
27
    {
28
        usort(
29
            $versions,
30
            function (Version $a, Version $b) {
31
                return VersionComparator::compare($a, $b);
32
            }
33
        );
34
35
        return $versions;
36
    }
37
}
38