ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables 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 12 of file Order.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 22 of file Order.php.

References ILIAS\Data\Order\checkDirection().

23  {
24  $this->checkDirection($direction);
25  $this->order[$subject] = $direction;
26  }
checkDirection(string $direction)
Definition: Order.php:35
+ Here is the call graph for this function:

Member Function Documentation

◆ append()

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

Definition at line 42 of file Order.php.

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

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

42  : Order
43  {
44  $this->checkSubject($subject);
45  $this->checkDirection($direction);
46  $clone = clone $this;
47  $clone->order[$subject] = $direction;
48  return $clone;
49  }
checkDirection(string $direction)
Definition: Order.php:35
checkSubject(string $subject)
Definition: Order.php:28
+ 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 35 of file Order.php.

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

35  : void
36  {
37  if ($direction !== self::ASC && $direction !== self::DESC) {
38  throw new \InvalidArgumentException("Direction bust be Order::ASC or Order::DESC.", 1);
39  }
40  }
+ Here is the caller graph for this function:

◆ checkSubject()

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

Definition at line 28 of file Order.php.

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

28  : void
29  {
30  if (array_key_exists($subject, $this->order)) {
31  throw new \InvalidArgumentException("already sorted by subject '$subject'", 1);
32  }
33  }
+ Here is the caller graph for this function:

◆ get()

ILIAS\Data\Order::get ( )
Returns
array<string, string>

Definition at line 54 of file Order.php.

References ILIAS\Data\Order\$order.

Referenced by orderTest\testAppend(), and orderTest\testValues().

54  : array
55  {
56  return $this->order;
57  }
array $order
Definition: Order.php:20
+ Here is the caller graph for this function:

◆ join()

ILIAS\Data\Order::join (   $init,
callable  $fn 
)

Definition at line 59 of file Order.php.

References ILIAS\LTI\ToolProvider\$key.

Referenced by ILIAS\UI\examples\Table\Data\base(), ILIAS\UI\examples\Table\Data\DataTableDemoRepo\doSelect(), orderTest\testJoinMore(), and orderTest\testJoinOne().

60  {
61  $ret = $init;
62  foreach ($this->order as $key => $value) {
63  $ret = $fn($ret, $key, $value);
64  }
65  return $ret;
66  }
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the caller graph for this function:

Field Documentation

◆ $order

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

Definition at line 20 of file Order.php.

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

◆ ASC

◆ DESC


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