parent
d293b3fe7b
commit
a603f32fd6
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace jrosset\Collections;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for comparable objects
|
||||||
|
*
|
||||||
|
* @template TObject of object
|
||||||
|
*/
|
||||||
|
interface IComparable {
|
||||||
|
/**
|
||||||
|
* Compare to another instance
|
||||||
|
*
|
||||||
|
* @param TObject $other The other instance
|
||||||
|
*
|
||||||
|
* @return int <br>< 0 if current instance is classed before the other instance
|
||||||
|
* <br>= 0 if current instance is classed equals the other instance
|
||||||
|
* <br>> 0 if current instance is classed after the other instance
|
||||||
|
*
|
||||||
|
* @noinspection PhpMissingParamTypeInspection
|
||||||
|
*/
|
||||||
|
public function compareTo ($other): int;
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace jrosset\Collections;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for classes comparing external objects
|
||||||
|
*
|
||||||
|
* @template TObject of object
|
||||||
|
*/
|
||||||
|
interface IComparator {
|
||||||
|
/**
|
||||||
|
* Compare two objects
|
||||||
|
*
|
||||||
|
* @param TObject $object1 The first object
|
||||||
|
* @param TObject $object2 The second object
|
||||||
|
*
|
||||||
|
* @return int <br>< 0 if the first object is classed before the second object
|
||||||
|
* <br>= 0 if the first object is classed equals the second object
|
||||||
|
* <br>> 0 if the first object is classed after the second object
|
||||||
|
*
|
||||||
|
* @noinspection PhpMissingParamTypeInspection
|
||||||
|
*/
|
||||||
|
public function compare ($object1, $object2): int;
|
||||||
|
}
|
Loading…
Reference in New Issue