ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Data\Order Class Reference

Both the subject and the direction need to be specified when expressing an order. More...

+ Collaboration diagram for ILIAS\Data\Order:

Public Member Functions

 __construct (string $subject, string $direction)
 
 append (string $subject, string $direction)
 
 get ()
 
 join ($init, callable $fn)
 

Data Fields

const ASC = 'ASC'
 
const DESC = 'DESC'
 

Protected Member Functions

 checkSubject (string $subject)
 
 checkDirection (string $direction)
 

Protected Attributes

array $order = []
 

Detailed Description

Both the subject and the direction need to be specified when expressing an order.

Author
Nils Haagen nils..nosp@m.haag.nosp@m.en@co.nosp@m.ncep.nosp@m.ts-an.nosp@m.d-tr.nosp@m.ainin.nosp@m.g.de

Definition at line 28 of file Order.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Data\Order::__construct ( string  $subject,
string  $direction 
)

Definition at line 38 of file Order.php.

References ILIAS\Data\Order\checkDirection().

39  {
40  $this->checkDirection($direction);
41  $this->order[$subject] = $direction;
42  }
checkDirection(string $direction)
Definition: Order.php:51
+ Here is the call graph for this function:

Member Function Documentation

◆ append()

ILIAS\Data\Order::append ( string  $subject,
string  $direction 
)

Definition at line 58 of file Order.php.

References ILIAS\Data\Order\checkDirection(), and ILIAS\Data\Order\checkSubject().

Referenced by orderTest\testAppend(), orderTest\testInvalidDirection(), and orderTest\testInvalidSubject().

58  : Order
59  {
60  $this->checkSubject($subject);
61  $this->checkDirection($direction);
62  $clone = clone $this;
63  $clone->order[$subject] = $direction;
64  return $clone;
65  }
checkDirection(string $direction)
Definition: Order.php:51
checkSubject(string $subject)
Definition: Order.php:44
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkDirection()

ILIAS\Data\Order::checkDirection ( string  $direction)
protected

Definition at line 51 of file Order.php.

Referenced by ILIAS\Data\Order\__construct(), and ILIAS\Data\Order\append().

51  : void
52  {
53  if ($direction !== self::ASC && $direction !== self::DESC) {
54  throw new \InvalidArgumentException("Direction bust be Order::ASC or Order::DESC.", 1);
55  }
56  }
+ Here is the caller graph for this function:

◆ checkSubject()

ILIAS\Data\Order::checkSubject ( string  $subject)
protected

Definition at line 44 of file Order.php.

Referenced by ILIAS\Data\Order\append().

44  : void
45  {
46  if (array_key_exists($subject, $this->order)) {
47  throw new \InvalidArgumentException("already sorted by subject '$subject'", 1);
48  }
49  }
+ Here is the caller graph for this function:

◆ get()

◆ join()

Field Documentation

◆ $order

array ILIAS\Data\Order::$order = []
protected

Definition at line 36 of file Order.php.

Referenced by ILIAS\Data\Order\get().

◆ ASC

◆ DESC


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