-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathSubClassComparable.php
More file actions
29 lines (27 loc) · 959 Bytes
/
SubClassComparable.php
File metadata and controls
29 lines (27 loc) · 959 Bytes
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
<?php
namespace Icecave\Parity;
/**
* An object that can compare itself to other objects that are the same type, or
* derived from the type in which compare() is implemented.
*/
interface SubClassComparable
{
/**
* Compare this object with another object of the same type, yielding a
* result according to the following table:
*
* +--------------------+---------------+
* | Condition | Result |
* +--------------------+---------------+
* | $this == $value | $result === 0 |
* | $this < $value | $result < 0 |
* | $this > $value | $result > 0 |
* +--------------------+---------------+
*
* @param object $value The object to compare.
*
* @return int The result of the comparison.
* @throws Exception\NotComparableException if $value is not the same type as $this.
*/
public function compare($value): int;
}