Open Journal Systems  3.3.0
Seboettg\Collection Namespace Reference

Namespaces

 Test
 

Data Structures

class  ArrayList
 
interface  Collection
 
class  Collections
 
interface  Comparable
 
class  Comparator
 
interface  ToArrayInterface
 

Functions

 add ($key, $element)
 
 append ($element)
 
 clear ()
 
 count ()
 
 current ()
 
 filter (\Closure $closure)
 
 filterByKeys (array $keys)
 
 flatten ()
 
 get ($key)
 
 getIterator ()
 
 hasKey ($key)
 
 hasValue ($value)
 
 map (\closure $mapFunction)
 
 next ()
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 prev ()
 
 remove ($key)
 
 replace (array $data)
 
 set ($key, $element)
 
 setArray (array $array)
 
 shuffle ()
 
 toArray ()
 

Variables

trait ArrayListTrait
 

Detailed Description

Created by PhpStorm. User: seboettg Date: 09.05.18 Time: 17:50

Function Documentation

◆ add()

Seboettg\Collection\add (   $key,
  $element 
)

Inserts the specified element at the specified position in this list. If an other element already exist at the specified position the affected positions will transformed into a numerated array. As well the existing element as the specified element will be appended to this array.

Parameters
$key
$element
Returns
$this

Definition at line 126 of file ArrayListTrait.php.

◆ append()

Seboettg\Collection\append (   $element)

Appends the specified element to the end of this list.

Parameters
$element
Returns
$this

Definition at line 111 of file ArrayListTrait.php.

◆ clear()

Seboettg\Collection\clear ( )

flush array list

Returns
$this

Definition at line 29 of file ArrayListTrait.php.

◆ count()

◆ current()

Seboettg\Collection\current ( )

Returns the value of the array element that's currently being pointed to by the internal pointer. It does not move the pointer in any way. If the internal pointer points beyond the end of the elements list or the array is empty, current returns false.

Returns
mixed|false

Definition at line 53 of file ArrayListTrait.php.

◆ filter()

Seboettg\Collection\filter ( \Closure  $closure)

returns a clone of this ArrayList, filtered by the given closure function

Parameters
\Closure$closure
Returns
ArrayList

Definition at line 273 of file ArrayListTrait.php.

◆ filterByKeys()

Seboettg\Collection\filterByKeys ( array  $keys)

returns a clone of this ArrayList, filtered by the given array keys

Parameters
array$keys
Returns
ArrayList

Definition at line 283 of file ArrayListTrait.php.

◆ flatten()

Seboettg\Collection\flatten ( )

Returns a new ArrayList containing an one-dimensional array of all elements of this ArrayList. Keys are going lost.

Returns
ArrayList

Definition at line 306 of file ArrayListTrait.php.

◆ get()

Seboettg\Collection\get (   $key)

returns element with key $key

Parameters
$key
Returns
mixed|null

Definition at line 40 of file ArrayListTrait.php.

◆ getIterator()

Seboettg\Collection\getIterator ( )

Definition at line 192 of file ArrayListTrait.php.

◆ hasKey()

Seboettg\Collection\hasKey (   $key)

Returns true if an element exists on the specified position.

Parameters
mixed$key
Returns
bool

Definition at line 158 of file ArrayListTrait.php.

◆ hasValue()

Seboettg\Collection\hasValue (   $value)

Returns true if the specified value exists in this list. Uses PHP's array_search function string $value mixed

Definition at line 171 of file ArrayListTrait.php.

◆ map()

Seboettg\Collection\map ( \closure  $mapFunction)

returns a new ArrayList containing all the elements of this ArrayList after applying the callback function to each one.

Parameters
\closure$mapFunction
Returns
ArrayList

Definition at line 297 of file ArrayListTrait.php.

◆ next()

Seboettg\Collection\next ( )

Advance the internal array pointer of an array. Returns the array value in the next place that's pointed to by the internal array pointer, or false if there are no more elements.

Returns
mixed|false

Definition at line 65 of file ArrayListTrait.php.

◆ offsetExists()

Seboettg\Collection\offsetExists (   $offset)

Whether a offset exists mixed $offset bool

Definition at line 227 of file ArrayListTrait.php.

◆ offsetGet()

Seboettg\Collection\offsetGet (   $offset)

◆ offsetSet()

Seboettg\Collection\offsetSet (   $offset,
  $value 
)

◆ offsetUnset()

Seboettg\Collection\offsetUnset (   $offset)

Offset to unset mixed $offset The offset to unset.

Definition at line 237 of file ArrayListTrait.php.

◆ prev()

Seboettg\Collection\prev ( )

Rewind the internal array pointer. Returns the array value in the previous place that's pointed to by the internal array pointer, or false if there are no more

Returns
mixed|false

Definition at line 77 of file ArrayListTrait.php.

◆ remove()

Seboettg\Collection\remove (   $key)

Removes the element at the specified position in this list.

Parameters
$key
Returns
$this

Definition at line 146 of file ArrayListTrait.php.

◆ replace()

Seboettg\Collection\replace ( array  $data)

replaces this list by the specified array

Parameters
array$data
Returns
ArrayList

Definition at line 183 of file ArrayListTrait.php.

Referenced by Seboettg\Collection\setArray().

◆ set()

Seboettg\Collection\set (   $key,
  $element 
)

Inserts or replaces the element at the specified position in this list with the specified element.

Parameters
$key
$element
Returns
$this

Definition at line 89 of file ArrayListTrait.php.

◆ setArray()

Seboettg\Collection\setArray ( array  $array)

overrides contents of ArrayList with the contents of $array

Parameters
array$array
Returns
$this

Definition at line 100 of file ArrayListTrait.php.

References Seboettg\Collection\replace().

◆ shuffle()

Seboettg\Collection\shuffle ( )

Shuffles this list (randomizes the order of the elements in). It uses the PHP function shuffle

See also
http://php.net/manual/en/function.shuffle.php
Returns
$this

Definition at line 263 of file ArrayListTrait.php.

◆ toArray()

Seboettg\Collection\toArray ( )

Definition at line 245 of file ArrayListTrait.php.

Variable Documentation

◆ ArrayListTrait

trait Seboettg::Collection\ArrayListTrait
Initial value:
{
protected $array

Definition at line 13 of file ArrayListTrait.php.