NumericKeyComparer::compare()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
ccs 0
cts 6
cp 0
rs 9.4285
cc 3
eloc 7
nc 3
nop 2
crap 12
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