ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Export\ImportStatus\ilCollection Class Reference
+ Inheritance diagram for ILIAS\Export\ImportStatus\ilCollection:
+ Collaboration diagram for ILIAS\Export\ImportStatus\ilCollection:

Public Member Functions

 __construct (ilImportStatusFactoryInterface $status,)
 
 hasStatusType (StatusType $type)
 
 withAddedStatus (ilHandlerInterface $import_status)
 
 getCollectionOfAllByType (StatusType $type)
 
 getMergedCollectionWith (ilCollectionInterface $other)
 
 current ()
 
 next ()
 
 key ()
 
 valid ()
 
 rewind ()
 
 count ()
 
 toArray ()
 
 withNumberingEnabled (bool $enabled)
 
 toString (StatusType ... $types)
 
 mergeContentToElements (ilImportStatusContentHandlerInterface $content, bool $at_front=true)
 
- Public Member Functions inherited from ILIAS\Export\ImportStatus\I\ilCollectionInterface
 hasStatusType (StatusType $type)
 
 withAddedStatus (ilImportStatusHandlerInterface $import_status)
 
 getCollectionOfAllByType (StatusType $type)
 
 getMergedCollectionWith (ilCollectionInterface $other)
 
 withNumberingEnabled (bool $enabled)
 
 toString (StatusType ... $types)
 
 mergeContentToElements (ilImportStatusContentHandlerInterface $content, bool $at_front=true)
 
 toArray ()
 
 current ()
 
 next ()
 
 key ()
 
 valid ()
 
 rewind ()
 
 count ()
 

Protected Member Functions

 getArrayOfElementsWithType (StatusType $type)
 

Protected Attributes

ilImportStatusFactoryInterface $status
 
array $elements
 
int $index
 
int $minIndex
 
bool $is_numbering_enabled
 

Detailed Description

Definition at line 28 of file class.ilCollection.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Export\ImportStatus\ilCollection::__construct ( ilImportStatusFactoryInterface  $status)

Definition at line 39 of file class.ilCollection.php.

41 {
42 $this->elements = [];
43 $this->minIndex = 0;
44 $this->index = $this->minIndex;
45 $this->is_numbering_enabled = false;
46 $this->status = $status;
47 }
ilImportStatusFactoryInterface $status

References ILIAS\Export\ImportStatus\ilCollection\$minIndex, and ILIAS\Export\ImportStatus\ilCollection\$status.

Member Function Documentation

◆ count()

ILIAS\Export\ImportStatus\ilCollection::count ( )

◆ current()

ILIAS\Export\ImportStatus\ilCollection::current ( )

Implements ILIAS\Export\ImportStatus\I\ilCollectionInterface.

Definition at line 88 of file class.ilCollection.php.

88 : ilHandlerInterface
89 {
90 return $this->elements[$this->index];
91 }

References ILIAS\Export\ImportStatus\ilCollection\$index.

◆ getArrayOfElementsWithType()

ILIAS\Export\ImportStatus\ilCollection::getArrayOfElementsWithType ( StatusType  $type)
protected
Returns
ilHandlerInterface[]

Definition at line 52 of file class.ilCollection.php.

52 : array
53 {
54 return array_filter(
55 $this->toArray(),
56 function (ilHandler $s) use ($type) {
57 return $s->getType() === $type;
58 }
59 );
60 }

References ILIAS\Export\ImportStatus\ilHandler\getType(), and ILIAS\Export\ImportStatus\ilCollection\toArray().

Referenced by ILIAS\Export\ImportStatus\ilCollection\getCollectionOfAllByType(), and ILIAS\Export\ImportStatus\ilCollection\hasStatusType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCollectionOfAllByType()

ILIAS\Export\ImportStatus\ilCollection::getCollectionOfAllByType ( StatusType  $type)

Definition at line 74 of file class.ilCollection.php.

74 : ilCollectionInterface
75 {
76 $clone = clone $this;
77 $clone->elements = $this->getArrayOfElementsWithType($type);
78 return $clone;
79 }

References ILIAS\Export\ImportStatus\ilCollection\getArrayOfElementsWithType().

Referenced by ILIAS\Export\ImportStatus\ilCollection\toString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMergedCollectionWith()

ILIAS\Export\ImportStatus\ilCollection::getMergedCollectionWith ( ilCollectionInterface  $other)

Implements ILIAS\Export\ImportStatus\I\ilCollectionInterface.

Definition at line 81 of file class.ilCollection.php.

81 : ilCollectionInterface
82 {
83 $clone = clone $this;
84 $clone->elements = array_merge($this->toArray(), $other->toArray());
85 return $clone;
86 }

References ILIAS\Export\ImportStatus\ilCollection\toArray(), and ILIAS\Export\ImportStatus\I\ilCollectionInterface\toArray().

+ Here is the call graph for this function:

◆ hasStatusType()

ILIAS\Export\ImportStatus\ilCollection::hasStatusType ( StatusType  $type)

Definition at line 62 of file class.ilCollection.php.

62 : bool
63 {
64 return count($this->getArrayOfElementsWithType($type)) > 0;
65 }

References ILIAS\Export\ImportStatus\ilCollection\count(), and ILIAS\Export\ImportStatus\ilCollection\getArrayOfElementsWithType().

+ Here is the call graph for this function:

◆ key()

ILIAS\Export\ImportStatus\ilCollection::key ( )

Implements ILIAS\Export\ImportStatus\I\ilCollectionInterface.

Definition at line 98 of file class.ilCollection.php.

98 : int
99 {
100 return $this->index;
101 }

References ILIAS\Export\ImportStatus\ilCollection\$index.

◆ mergeContentToElements()

ILIAS\Export\ImportStatus\ilCollection::mergeContentToElements ( ilImportStatusContentHandlerInterface  $content,
bool  $at_front = true 
)

Implements ILIAS\Export\ImportStatus\I\ilCollectionInterface.

Definition at line 154 of file class.ilCollection.php.

157 : ilCollectionInterface {
158 $clone = clone $this;
159 $new_elements = [];
160 foreach ($clone->toArray() as $element) {
161 $new_elements[] = $at_front
162 ? $this->status->handler()
163 ->withType($element->getType())
164 ->withContent($content->mergeWith($element->getContent()))
165 : $this->status->handler()
166 ->withType($element->getType())
167 ->withContent($element->getContent()->mergeWith($content));
168 }
169 $clone->elements = $new_elements;
170 return $clone;
171 }

◆ next()

ILIAS\Export\ImportStatus\ilCollection::next ( )

Implements ILIAS\Export\ImportStatus\I\ilCollectionInterface.

Definition at line 93 of file class.ilCollection.php.

93 : void
94 {
95 $this->index++;
96 }

◆ rewind()

ILIAS\Export\ImportStatus\ilCollection::rewind ( )

Implements ILIAS\Export\ImportStatus\I\ilCollectionInterface.

Definition at line 108 of file class.ilCollection.php.

108 : void
109 {
110 $this->index = $this->minIndex;
111 }

References ILIAS\Export\ImportStatus\ilCollection\$minIndex.

◆ toArray()

ILIAS\Export\ImportStatus\ilCollection::toArray ( )

◆ toString()

ILIAS\Export\ImportStatus\ilCollection::toString ( StatusType ...  $types)

Definition at line 133 of file class.ilCollection.php.

133 : string
134 {
135 $collection = $this->status->collection();
136 $msg = "<br>Listing status messages (of type(s)";
137 foreach ($types as $type) {
138 $msg .= " " . $type->name;
139 $collection = $collection->getMergedCollectionWith($this->getCollectionOfAllByType($type));
140 }
141 $msg .= "):<br>";
142 $elements = $collection->toArray();
143 for($i = 0; $i < count($elements); $i++) {
144 $faied_status = $elements[$i];
145 $msg .= "<br>";
146 $msg .= $this->is_numbering_enabled
147 ? '[' . $i . ']: '
148 : '';
149 $msg .= $faied_status->getContent()->toString();
150 }
151 return $msg;
152 }

References ILIAS\Export\ImportStatus\ilCollection\$elements, ILIAS\Export\ImportStatus\ilCollection\count(), and ILIAS\Export\ImportStatus\ilCollection\getCollectionOfAllByType().

+ Here is the call graph for this function:

◆ valid()

ILIAS\Export\ImportStatus\ilCollection::valid ( )

Implements ILIAS\Export\ImportStatus\I\ilCollectionInterface.

Definition at line 103 of file class.ilCollection.php.

103 : bool
104 {
105 return $this->minIndex <= $this->index && $this->index < $this->count();
106 }

References ILIAS\Export\ImportStatus\ilCollection\count().

+ Here is the call graph for this function:

◆ withAddedStatus()

ILIAS\Export\ImportStatus\ilCollection::withAddedStatus ( ilHandlerInterface  $import_status)

Definition at line 67 of file class.ilCollection.php.

67 : ilCollection
68 {
69 $clone = clone $this;
70 $clone->elements[] = $import_status;
71 return $clone;
72 }

◆ withNumberingEnabled()

ILIAS\Export\ImportStatus\ilCollection::withNumberingEnabled ( bool  $enabled)

Implements ILIAS\Export\ImportStatus\I\ilCollectionInterface.

Definition at line 126 of file class.ilCollection.php.

126 : ilCollectionInterface
127 {
128 $clone = clone $this;
129 $clone->is_numbering_enabled = $enabled;
130 return $clone;
131 }

Field Documentation

◆ $elements

array ILIAS\Export\ImportStatus\ilCollection::$elements
protected

◆ $index

int ILIAS\Export\ImportStatus\ilCollection::$index
protected

◆ $is_numbering_enabled

bool ILIAS\Export\ImportStatus\ilCollection::$is_numbering_enabled
protected

Definition at line 37 of file class.ilCollection.php.

◆ $minIndex

int ILIAS\Export\ImportStatus\ilCollection::$minIndex
protected

◆ $status

ilImportStatusFactoryInterface ILIAS\Export\ImportStatus\ilCollection::$status
protected

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