NumericKeyComparer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 0
dl 0
loc 17
ccs 0
cts 6
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A compare() 0 10 3
1
<?php
2
3
// Copyright (c) Lellys Informática. All rights reserved. See License.txt in the project root for license information.
4
namespace Collections\Comparer;
5
6
use Collections\Generic\ComparerInterface;
7
8
/**
9
 * Represents a numeric key comparison operation that uses specific case and culture-based or ordinal comparison rules.
10
 */
11
class NumericKeyComparer implements ComparerInterface
12
{
13
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function compare($first, $second)
18
    {
19
        if ($first < $second) {
20
            return 1;
21
        } elseif ($first === $second) {
22
            return 0;
23
        } else {
24
            return -1;
25
        }
26
    }
27
}
28