4 require_once
'Services/Contact/BuddySystem/interfaces/interface.ilBuddySystemCollection.php';
47 return $this->
get($offset);
55 if (!isset($offset)) {
60 $this->
set($offset, $value);
68 $this->
remove($offset);
76 return count($this->elements);
82 public function add($element)
84 $this->elements[] = $element;
90 public function remove(
$key)
92 if (!isset($this->elements[
$key]) && !array_key_exists($key, $this->elements)) {
95 unset($this->elements[$key]);
103 $key = array_search($element, $this->elements,
true);
104 if (
false ===
$key) {
107 unset($this->elements[
$key]);
115 return isset($this->elements[
$key]) || array_key_exists($key, $this->elements);
124 return array_search($element, $this->elements,
true);
132 $this->elements = array();
140 return in_array($element, $this->elements,
true);
148 return isset($this->elements[
$key]) ? $this->elements[
$key] : null;
154 public function set(
$key, $value)
156 $this->elements[
$key] = $value;
164 return empty($this->elements);
172 return array_keys($this->elements);
180 return array_values($this->elements);
188 return new static(array_filter($this->elements, $p));
194 public function slice($offset, $length = null)
196 return new static(array_slice($this->elements, $offset, $length,
true));
add($element)
Adds an element at the end of the collection.
getValues()
Gets all values of the collection.array The values of all elements in the collection, in the order they appear in the collection.
isEmpty()
boolean true if the collection is empty, false otherwise.
Interface ilBuddySystemCollection.
__construct(array $elements=array())
Class ilBuddySystemArrayCollection A collection which contains all entries of a buddy list...
offsetSet($offset, $value)
filter(Closure $p)
Returns all the elements of this collection that satisfy the predicate $callable.ilBuddySystemCollect...
slice($offset, $length=null)
Extracts a slice of $length elements starting at position $offset from the Collection.If $length is null it returns all elements from $offset to the end of the Collection. Calling this method will only return the selected slice and NOT change the elements contained in the collection slice is called on. The offset to start from. The maximum number of elements to return, or null for no limit. ilBuddySystemCollection
containsKey($key)
The index to check for. boolean true if the collection contains the element, false otherwise...
contains($element)
boolean true if the collection contains the element, false otherwise.
getKeys()
Gets all indices of the collection.array The indices of the collection, in the order of the correspon...
removeElement($element)
The element to remove.