-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathComparator.php
More file actions
37 lines (34 loc) · 1 KB
/
Comparator.php
File metadata and controls
37 lines (34 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
namespace Icecave\Parity\Comparator;
/**
* An object that can compare two values.
*/
interface Comparator
{
/**
* Compare two values, yielding a result according to the following table:
*
* +--------------------+---------------+
* | Condition | Result |
* +--------------------+---------------+
* | $this == $value | $result === 0 |
* | $this < $value | $result < 0 |
* | $this > $value | $result > 0 |
* +--------------------+---------------+
*
* @param mixed $lhs The first value to compare.
* @param mixed $rhs The second value to compare.
*
* @return int The result of the comparison.
*/
public function compare($lhs, $rhs): int;
/**
* An alias for compare().
*
* @param mixed $lhs The first value to compare.
* @param mixed $rhs The second value to compare.
*
* @return int The result of the comparison.
*/
public function __invoke($lhs, $rhs): int;
}