Methods summary
public
|
#
__construct( array $data = array() )
Parameters
- $data
- Associative array of data to set
|
public static
Guzzle\Common\Collection
|
#
fromConfig( array $config = array(), array $defaults = array(), array $required = array() )
Create a new collection from an array, validate the keys, and add default values where missing
Create a new collection from an array, validate the keys, and add default values where missing
Parameters
- $config
- Configuration values to apply.
- $defaults
- Default parameters
- $required
- Required parameter names
Returns
Throws
|
public
|
|
public
|
|
public
array
|
#
toArray( )
Get the array representation of an object
Get the array representation of an object
Returns
array
Implementation of
|
public
Guzzle\Common\Collection
|
#
clear( )
Removes all key value pairs
Removes all key value pairs
Returns
|
public
array
|
#
getAll( array $keys = null )
Get all or a subset of matching key value pairs
Get all or a subset of matching key value pairs
Parameters
- $keys
- Pass an array of keys to retrieve only a subset of key value pairs
Returns
array Returns an array of all matching key value pairs
|
public
mixed|null
|
#
get( string $key )
Get a specific key value.
Get a specific key value.
Parameters
Returns
mixed|null Value of the key or NULL
|
public
Guzzle\Common\Collection
|
#
set( string $key, mixed $value )
Set a key value pair
Parameters
- $key
- Key to set
- $value
- Value to set
Returns
|
public
Guzzle\Common\Collection
|
#
add( string $key, mixed $value )
Add a value to a key. If a key of the same name has already been added, the key value will be converted into an
array and the new value will be pushed to the end of the array.
Add a value to a key. If a key of the same name has already been added, the key value will be converted into an
array and the new value will be pushed to the end of the array.
Parameters
- $key
- Key to add
- $value
- Value to add to the key
Returns
|
public
Guzzle\Common\Collection
|
#
remove( string $key )
Remove a specific key value pair
Remove a specific key value pair
Parameters
Returns
|
public
array
|
#
getKeys( )
Get all keys in the collection
Get all keys in the collection
Returns
array
|
public
boolean
|
#
hasKey( string $key )
Returns whether or not the specified key is present.
Returns whether or not the specified key is present.
Parameters
- $key
- The key for which to check the existence.
Returns
boolean
|
public
boolean|string
|
#
keySearch( string $key )
Case insensitive search the keys in the collection
Case insensitive search the keys in the collection
Parameters
Returns
boolean|string Returns false if not found, otherwise returns the key
|
public
mixed
|
#
hasValue( string $value )
Checks if any keys contains a certain value
Checks if any keys contains a certain value
Parameters
- $value
- Value to search for
Returns
mixed Returns the key if the value was found FALSE if the value was not found.
|
public
Guzzle\Common\Collection
|
#
replace( array $data )
Replace the data of the object with the value of an array
Replace the data of the object with the value of an array
Parameters
- $data
- Associative array of data
Returns
|
public
Guzzle\Common\Collection
|
#
merge( Guzzle\Common\Collection |array $data )
Add and merge in a Collection or array of key value pair data.
Add and merge in a Collection or array of key value pair data.
Parameters
- $data
- Associative array of key value pair data
Returns
|
public
Guzzle\Common\Collection
|
#
overwriteWith( array|Traversable $data )
Over write key value pairs in this collection with all of the data from an array or collection.
Over write key value pairs in this collection with all of the data from an array or collection.
Parameters
- $data
- Values to override over this config
Returns
|
public
Guzzle\Common\Collection
|
#
map( Closure $closure, array $context = array(), boolean $static = true )
Returns a Collection containing all the elements of the collection after applying the callback function to each
one. The Closure should accept three parameters: (string) $key, (string) $value, (array) $context and return a
modified value
Returns a Collection containing all the elements of the collection after applying the callback function to each
one. The Closure should accept three parameters: (string) $key, (string) $value, (array) $context and return a
modified value
Parameters
- $closure
- Closure to apply
- $context
- Context to pass to the closure
- $static
- Set to TRUE to use the same class as the return rather than returning a Collection
Returns
|
public
Guzzle\Common\Collection
|
#
filter( Closure $closure, boolean $static = true )
Iterates over each key value pair in the collection passing them to the Closure. If the Closure function returns
true, the current value from input is returned into the result Collection. The Closure must accept three
parameters: (string) $key, (string) $value and return Boolean TRUE or FALSE for each value.
Iterates over each key value pair in the collection passing them to the Closure. If the Closure function returns
true, the current value from input is returned into the result Collection. The Closure must accept three
parameters: (string) $key, (string) $value and return Boolean TRUE or FALSE for each value.
Parameters
- $closure
- Closure evaluation function
- $static
- Set to TRUE to use the same class as the return rather than returning a Collection
Returns
|
public
|
|
public
|
|
public
|
|
public
|
|
public
Guzzle\Common\Collection
|
#
setPath( string $path, mixed $value )
Set a value into a nested array key. Keys will be created as needed to set the value.
Set a value into a nested array key. Keys will be created as needed to set the value.
Parameters
- $path
- Path to set
- $value
- Value to set at the key
Returns
Throws
RuntimeException when trying to setPath using a nested path that travels through a scalar value
|
public
mixed|null
|
#
getPath( string $path, string $separator = '/', mixed $data = null )
Gets a value from the collection using an array path (e.g. foo/baz/bar would retrieve bar from two nested arrays)
Allows for wildcard searches which recursively combine matches up to the level at which the wildcard occurs. This
can be useful for accepting any key of a sub-array and combining matching keys from each diverging path.
Gets a value from the collection using an array path (e.g. foo/baz/bar would retrieve bar from two nested arrays)
Allows for wildcard searches which recursively combine matches up to the level at which the wildcard occurs. This
can be useful for accepting any key of a sub-array and combining matching keys from each diverging path.
Parameters
- $path
- Path to traverse and retrieve a value from
- $separator
- Character used to add depth to the search
- $data
- Optional data to descend into (used when wildcards are encountered)
Returns
mixed|null
|
public
string
|
#
inject( string $input )
Inject configuration settings into an input string
Inject configuration settings into an input string
Deprecated
Parameters
Returns
string
|