PHP Interface Pinq\Iterators\IOrderedMap

Author: Elliot Levin ([email protected])
Inheritance: extends Traversable, extends ArrayAccess, extends Countable
Exibir arquivo Open project: timetoogo/pinq Interface Usage Examples

Public Methods

Method Description
clear ( ) : void Removes all keys and values from the map.
contains ( mixed $key ) : boolean Returns whether their is value associated with the supplied key.
get ( mixed $key ) : mixed Returns the value associated with the supplied key or null if it does not exist.
groupBy ( callable $groupKeyFunction ) : Pinq\Iterators\IOrderedMap Groups the keys / values using the supplied function into new ordered map.
keys ( ) : array Returns all the keys from the map as an array.
map ( callable $function ) : Pinq\Iterators\IOrderedMap Maps the keys / values of the dictionary to new dictionary.
multisort ( array $orderFunctions, array $isAscending ) : Pinq\Iterators\IOrderedMap Creates a new ordered map with the keys and values sorted according the the supplied functions and order directions.
offsetGet ( mixed $key ) : mixed Returns the value associated with the supplied key or null if it does not exist.
remove ( mixed $key ) : boolean Removes the element (if exists) with the supplied key.
set ( mixed $key, mixed $value ) : void Sets the supplied key to the supplied value.
setAll ( Traversable $elements ) : void Sets the supplied keys and values from the elements iterator.
setRef ( mixed $key, mixed &$value ) : void Sets the supplied key to the supplied value by reference.
values ( ) : array Returns all the values from the map as an array.
walk ( callable $function ) : void Walks the elements with the supplied function

Method Details

clear() public method

Removes all keys and values from the map.
public clear ( ) : void
return void

contains() public method

Returns whether their is value associated with the supplied key.
public contains ( mixed $key ) : boolean
$key mixed
return boolean

get() public method

Returns the value associated with the supplied key or null if it does not exist.
public get ( mixed $key ) : mixed
$key mixed
return mixed

groupBy() public method

Groups the keys / values using the supplied function into new ordered map.
public groupBy ( callable $groupKeyFunction ) : Pinq\Iterators\IOrderedMap
$groupKeyFunction callable
return Pinq\Iterators\IOrderedMap

keys() public method

Indexed by their 0-based position.
public keys ( ) : array
return array

map() public method

Maps the keys / values of the dictionary to new dictionary.
public map ( callable $function ) : Pinq\Iterators\IOrderedMap
$function callable The elements are passed as ($value, $key)
return Pinq\Iterators\IOrderedMap

multisort() public method

Creates a new ordered map with the keys and values sorted according the the supplied functions and order directions.
public multisort ( array $orderFunctions, array $isAscending ) : Pinq\Iterators\IOrderedMap
$orderFunctions array
$isAscending array
return Pinq\Iterators\IOrderedMap

offsetGet() public method

Returns the value associated with the supplied key or null if it does not exist.
public offsetGet ( mixed $key ) : mixed
$key mixed
return mixed

remove() public method

Removes the element (if exists) with the supplied key.
public remove ( mixed $key ) : boolean
$key mixed
return boolean Whether the key was succefully remove or false if does not exist

set() public method

Sets the supplied key to the supplied value.
public set ( mixed $key, mixed $value ) : void
$key mixed
$value mixed
return void

setAll() public method

Sets the supplied keys and values from the elements iterator.
public setAll ( Traversable $elements ) : void
$elements Traversable
return void

setRef() public method

Sets the supplied key to the supplied value by reference.
public setRef ( mixed $key, mixed &$value ) : void
$key mixed
$value mixed
return void

values() public method

Indexed by their 0-based position.
public values ( ) : array
return array

walk() public method

Walks the elements with the supplied function
public walk ( callable $function ) : void
$function callable
return void