ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Mail\Autoresponder\AutoresponderArrayCollection Class Reference
+ Inheritance diagram for ILIAS\Mail\Autoresponder\AutoresponderArrayCollection:
+ Collaboration diagram for ILIAS\Mail\Autoresponder\AutoresponderArrayCollection:

Public Member Functions

 __construct (private array $elements=[])
 
 getIterator ()
 
 offsetExists (int $offset)
 
 offsetGet (int $offset)
 
 offsetSet (int $offset, AutoresponderDto $value)
 
 offsetUnset (int $offset)
 
 count ()
 
 add (AutoresponderDto $element)
 
 remove ($key)
 
 removeElement (AutoresponderDto $element)
 
 containsKey ($key)
 
 getKey (AutoresponderDto $element)
 
 clear ()
 
 contains (AutoresponderDto $element)
 
 get ($key)
 
 set ($key, AutoresponderDto $value)
 
 isEmpty ()
 
 getKeys ()
 
 getValues ()
 
 filter (callable $callable)
 
 slice (int $offset, ?int $length=null)
 
 toArray ()
 
 equals ($other)
 
 add (AutoresponderDto $element)
 
 remove ($key)
 
 removeElement (AutoresponderDto $element)
 
 containsKey ($key)
 
 getKey (AutoresponderDto $element)
 
 clear ()
 
 contains (AutoresponderDto $element)
 
 get ($key)
 
 set ($key, AutoresponderDto $value)
 
 isEmpty ()
 
 getKeys ()
 
 getValues ()
 
 filter (callable $callable)
 
 slice (int $offset, ?int $length=null)
 
 toArray ()
 
 equals ($other)
 

Detailed Description

Definition at line 26 of file AutoresponderArrayCollection.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::__construct ( private array  $elements = [])
Parameters
AutoresponderDto[]|array<int|string,AutoresponderDto>$elements

Definition at line 31 of file AutoresponderArrayCollection.php.

32 {
33 }

Member Function Documentation

◆ add()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::add ( AutoresponderDto  $element)

Implements ILIAS\Mail\Autoresponder\AutoresponderCollection.

Definition at line 71 of file AutoresponderArrayCollection.php.

71 : void
72 {
73 $this->elements[] = $element;
74 }

Referenced by ILIAS\Mail\Autoresponder\AutoresponderArrayCollection\offsetSet().

+ Here is the caller graph for this function:

◆ clear()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::clear ( )

Implements ILIAS\Mail\Autoresponder\AutoresponderCollection.

Definition at line 107 of file AutoresponderArrayCollection.php.

107 : void
108 {
109 $this->elements = [];
110 }

◆ contains()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::contains ( AutoresponderDto  $element)

Implements ILIAS\Mail\Autoresponder\AutoresponderCollection.

Definition at line 112 of file AutoresponderArrayCollection.php.

112 : bool
113 {
114 return \in_array($element, $this->elements, true);
115 }

◆ containsKey()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::containsKey (   $key)
Parameters
int | string$key

Implements ILIAS\Mail\Autoresponder\AutoresponderCollection.

Definition at line 93 of file AutoresponderArrayCollection.php.

93 : bool
94 {
95 return isset($this->elements[$key]);
96 }

Referenced by ILIAS\Mail\Autoresponder\AutoresponderArrayCollection\offsetExists(), and ILIAS\Mail\Autoresponder\AutoresponderArrayCollection\remove().

+ Here is the caller graph for this function:

◆ count()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::count ( )

Definition at line 66 of file AutoresponderArrayCollection.php.

66 : int
67 {
68 return \count($this->elements);
69 }

◆ equals()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::equals (   $other)

Implements ILIAS\Mail\Autoresponder\AutoresponderCollection.

Definition at line 159 of file AutoresponderArrayCollection.php.

159 : bool
160 {
161 if (!$other instanceof self) {
162 return false;
163 }
164
165 $self = $this->toArray();
166 $other = $other->toArray();
167
168 sort($self);
169 sort($other);
170
171 return $self === $other;
172 }

References ILIAS\UI\examples\Symbol\Glyph\Sort\sort(), and ILIAS\Mail\Autoresponder\AutoresponderArrayCollection\toArray().

+ Here is the call graph for this function:

◆ filter()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::filter ( callable  $callable)

Implements ILIAS\Mail\Autoresponder\AutoresponderCollection.

Definition at line 142 of file AutoresponderArrayCollection.php.

142 : AutoresponderCollection
143 {
144 $filtered = array_filter($this->elements, $callable);
145 return new self($filtered);
146 }

◆ get()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::get (   $key)
Parameters
int | string$key

Implements ILIAS\Mail\Autoresponder\AutoresponderCollection.

Definition at line 117 of file AutoresponderArrayCollection.php.

117 : ?AutoresponderDto
118 {
119 return $this->elements[$key] ?? null;
120 }

◆ getIterator()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::getIterator ( )

Definition at line 35 of file AutoresponderArrayCollection.php.

35 : ArrayIterator
36 {
37 return new ArrayIterator($this->elements);
38 }

◆ getKey()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::getKey ( AutoresponderDto  $element)

Implements ILIAS\Mail\Autoresponder\AutoresponderCollection.

Definition at line 98 of file AutoresponderArrayCollection.php.

98 : int
99 {
100 $key = array_search($element, $this->elements, true);
101 if ($key === false) {
102 throw new InvalidArgumentException('Could not find an key for the passed element.');
103 }
104 return $key;
105 }

◆ getKeys()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::getKeys ( )
Returns
array<int|string> $key

Implements ILIAS\Mail\Autoresponder\AutoresponderCollection.

Definition at line 132 of file AutoresponderArrayCollection.php.

132 : array
133 {
134 return array_keys($this->elements);
135 }

◆ getValues()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::getValues ( )
Returns
AutoresponderDto[] $

Implements ILIAS\Mail\Autoresponder\AutoresponderCollection.

Definition at line 137 of file AutoresponderArrayCollection.php.

137 : array
138 {
139 return array_values($this->elements);
140 }

◆ isEmpty()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::isEmpty ( )

Implements ILIAS\Mail\Autoresponder\AutoresponderCollection.

Definition at line 127 of file AutoresponderArrayCollection.php.

127 : bool
128 {
129 return empty($this->elements);
130 }

◆ offsetExists()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::offsetExists ( int  $offset)

Definition at line 40 of file AutoresponderArrayCollection.php.

40 : bool
41 {
42 return $this->containsKey($offset);
43 }

References ILIAS\Mail\Autoresponder\AutoresponderArrayCollection\containsKey().

+ Here is the call graph for this function:

◆ offsetGet()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::offsetGet ( int  $offset)

Definition at line 45 of file AutoresponderArrayCollection.php.

45 : AutoresponderDto
46 {
47 return $this->get($offset);
48 }

◆ offsetSet()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::offsetSet ( int  $offset,
AutoresponderDto  $value 
)

Definition at line 50 of file AutoresponderArrayCollection.php.

50 : void
51 {
52 if (!isset($offset)) {
53 $this->add($value);
54
55 return;
56 }
57
58 $this->set($offset, $value);
59 }

References ILIAS\Mail\Autoresponder\AutoresponderArrayCollection\add().

+ Here is the call graph for this function:

◆ offsetUnset()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::offsetUnset ( int  $offset)

Definition at line 61 of file AutoresponderArrayCollection.php.

61 : void
62 {
63 $this->remove($offset);
64 }

◆ remove()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::remove (   $key)
Parameters
string | int$key
Exceptions
InvalidArgumentException

Implements ILIAS\Mail\Autoresponder\AutoresponderCollection.

Definition at line 76 of file AutoresponderArrayCollection.php.

76 : void
77 {
78 if (!$this->containsKey($key)) {
79 throw new InvalidArgumentException("Key $key does not exist.");
80 }
81 unset($this->elements[$key]);
82 }

References ILIAS\Mail\Autoresponder\AutoresponderArrayCollection\containsKey().

+ Here is the call graph for this function:

◆ removeElement()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::removeElement ( AutoresponderDto  $element)
Exceptions
InvalidArgumentException

Implements ILIAS\Mail\Autoresponder\AutoresponderCollection.

Definition at line 84 of file AutoresponderArrayCollection.php.

84 : void
85 {
86 $key = array_search($element, $this->elements, true);
87 if ($key === false) {
88 throw new InvalidArgumentException('Could not find an key for the passed element.');
89 }
90 unset($this->elements[$key]);
91 }

◆ set()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::set (   $key,
AutoresponderDto  $value 
)
Parameters
int | string$key

Implements ILIAS\Mail\Autoresponder\AutoresponderCollection.

Definition at line 122 of file AutoresponderArrayCollection.php.

122 : void
123 {
124 $this->elements[$key] = $value;
125 }

◆ slice()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::slice ( int  $offset,
?int  $length = null 
)

Implements ILIAS\Mail\Autoresponder\AutoresponderCollection.

Definition at line 148 of file AutoresponderArrayCollection.php.

148 : AutoresponderCollection
149 {
150 $sliced = \array_slice($this->elements, $offset, $length, true);
151 return new self($sliced);
152 }

◆ toArray()

ILIAS\Mail\Autoresponder\AutoresponderArrayCollection::toArray ( )
Returns
AutoresponderDto[]|array<int|string, AutoresponderDto>

Implements ILIAS\Mail\Autoresponder\AutoresponderCollection.

Definition at line 154 of file AutoresponderArrayCollection.php.

154 : array
155 {
156 return $this->elements;
157 }

Referenced by ILIAS\Mail\Autoresponder\AutoresponderArrayCollection\equals().

+ Here is the caller graph for this function:

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