Open Journal Systems  3.3.0
Seboettg\Collection\Comparator Class Reference
Inheritance diagram for Seboettg\Collection\Comparator:
Seboettg\Collection\Test\MyAscendingComparator Seboettg\Collection\Test\MyCustomOrderComparator Seboettg\Collection\Test\MyDescendingComparator

Public Member Functions

 __construct ($sortingOrder=self::ORDER_ASC, $customOrder=null)
 
 compare (Comparable $a, Comparable $b)
 

Data Fields

const ORDER_ASC = "ASC"
 
const ORDER_CUSTOM = "CUSTOM"
 
const ORDER_DESC = "DESC"
 

Protected Attributes

 $customOrder
 
 $sortingOrder
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

Seboettg\Collection\Comparator::__construct (   $sortingOrder = self::ORDER_ASC,
  $customOrder = null 
)

Comparator constructor.

Parameters
string$sortingOrderdefines the order (ascending|descending) for a comparison
mixed$customOrder

Definition at line 65 of file generic/citationStyleLanguage/lib/vendor/seboettg/collection/src/Seboettg/Collection/Comparator.php.

References Seboettg\Collection\Comparator\$customOrder, and Seboettg\Collection\Comparator\$sortingOrder.

Member Function Documentation

◆ compare()

Seboettg\Collection\Comparator::compare ( Comparable  $a,
Comparable  $b 
)
abstract

Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

Parameters
Comparable$a
Comparable$b
Returns
int

Reimplemented in Seboettg\Collection\Test\MyCustomOrderComparator, Seboettg\Collection\Test\MyDescendingComparator, and Seboettg\Collection\Test\MyAscendingComparator.

Field Documentation

◆ $customOrder

mixed Seboettg\Collection\Comparator::$customOrder
protected

object/array which can be used to define a custom order

Definition at line 58 of file generic/citationStyleLanguage/lib/vendor/seboettg/collection/src/Seboettg/Collection/Comparator.php.

Referenced by Seboettg\Collection\Comparator\__construct().

◆ $sortingOrder

string Seboettg\Collection\Comparator::$sortingOrder
protected

defines the order (ascending|descending) for a comparison

Definition at line 49 of file generic/citationStyleLanguage/lib/vendor/seboettg/collection/src/Seboettg/Collection/Comparator.php.

Referenced by Seboettg\Collection\Comparator\__construct().

◆ ORDER_ASC

const Seboettg\Collection\Comparator::ORDER_ASC = "ASC"

static constant for sorting order ascending

Definition at line 29 of file generic/citationStyleLanguage/lib/vendor/seboettg/collection/src/Seboettg/Collection/Comparator.php.

◆ ORDER_CUSTOM

const Seboettg\Collection\Comparator::ORDER_CUSTOM = "CUSTOM"

◆ ORDER_DESC

const Seboettg\Collection\Comparator::ORDER_DESC = "DESC"

static constant for sorting order descending

Definition at line 34 of file generic/citationStyleLanguage/lib/vendor/seboettg/collection/src/Seboettg/Collection/Comparator.php.


The documentation for this class was generated from the following file: