ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\Tracking\Status\Collection Class Reference
+ Inheritance diagram for ILIAS\Tracking\Status\Collection:
+ Collaboration diagram for ILIAS\Tracking\Status\Collection:

Public Member Functions

 __construct (protected FactoryInterface $factory, LPStatusInterface ... $elements)
 
 getElementsByStatusIds (string ... $lp_status_ids)
 
 getElementByStatusId (string $lp_status_id)
 
 current ()
 
 key ()
 
 next ()
 
 valid ()
 
 rewind ()
 
 count ()
 
 getElementsByStatusIds (string ... $lp_status_ids)
 
 getElementByStatusId (string $lp_status_id)
 
 current ()
 
 key ()
 

Protected Attributes

array $elements
 
int $index
 

Detailed Description

Definition at line 23 of file Collection.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Tracking\Status\Collection::__construct ( protected FactoryInterface  $factory,
LPStatusInterface ...  $elements 
)

Definition at line 29 of file Collection.php.

32 {
33 $this->elements = $elements;
34 $this->index = 0;
35 }

References ILIAS\Tracking\Status\Collection\$elements.

Member Function Documentation

◆ count()

ILIAS\Tracking\Status\Collection::count ( )

Definition at line 87 of file Collection.php.

87 : int
88 {
89 return count($this->elements);
90 }

◆ current()

ILIAS\Tracking\Status\Collection::current ( )

Implements ILIAS\Tracking\Status\CollectionInterface.

Definition at line 62 of file Collection.php.

62 : LPStatusInterface
63 {
64 return $this->elements[$this->index];
65 }

◆ getElementByStatusId()

ILIAS\Tracking\Status\Collection::getElementByStatusId ( string  $lp_status_id)

Implements ILIAS\Tracking\Status\CollectionInterface.

Definition at line 51 of file Collection.php.

53 : LPStatusInterface|null {
54 foreach ($this->elements as $element) {
55 if ($element->getLPStatusId() === $lp_status_id) {
56 return $element;
57 }
58 }
59 return null;
60 }

Referenced by ILIAS\Tracking\Status\Collection\getElementsByStatusIds().

+ Here is the caller graph for this function:

◆ getElementsByStatusIds()

ILIAS\Tracking\Status\Collection::getElementsByStatusIds ( string ...  $lp_status_ids)

Implements ILIAS\Tracking\Status\CollectionInterface.

Definition at line 37 of file Collection.php.

39 : CollectionInterface {
40 $elements = [];
41 foreach ($lp_status_ids as $lp_status_id) {
42 $element = $this->getElementByStatusId($lp_status_id);
43 if (is_null($element)) {
44 continue;
45 }
46 $elements[] = $element;
47 }
48 return $this->factory->collection(...$elements);
49 }
factory()
getElementByStatusId(string $lp_status_id)
Definition: Collection.php:51

References ILIAS\Tracking\Status\Collection\$elements, and ILIAS\Tracking\Status\Collection\getElementByStatusId().

+ Here is the call graph for this function:

◆ key()

ILIAS\Tracking\Status\Collection::key ( )

Implements ILIAS\Tracking\Status\CollectionInterface.

Definition at line 67 of file Collection.php.

67 : int
68 {
69 return $this->index;
70 }

◆ next()

ILIAS\Tracking\Status\Collection::next ( )

Definition at line 72 of file Collection.php.

72 : void
73 {
74 $this->index++;
75 }

◆ rewind()

ILIAS\Tracking\Status\Collection::rewind ( )

Definition at line 82 of file Collection.php.

82 : void
83 {
84 $this->index = 0;
85 }

◆ valid()

ILIAS\Tracking\Status\Collection::valid ( )

Definition at line 77 of file Collection.php.

77 : bool
78 {
79 return isset($this->elements[$this->index]);
80 }

Field Documentation

◆ $elements

array ILIAS\Tracking\Status\Collection::$elements
protected

◆ $index

int ILIAS\Tracking\Status\Collection::$index
protected

Definition at line 27 of file Collection.php.


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