Extends
\Hazaar\MapMethods | Properties | Constants |
---|---|---|
No constants |
Parameters
$uri | No description | |
$method | No description | |
$content_type | No description |
Parameters
$data | No description | |
$content_type | No description |
Parameters
$user | No description | |
$type | No description |
Parameters
$username | No description | |
$password | No description | |
$method | No description |
Parameters
$user | No description | |
$type | No description |
Parameters
$key | No description |
Parameters
$body | No description |
Parameters
$key | No description | |
$value | No description |
Parameters
$uri | No description |
Parameters
$cookie | No description |
Return the current element in the Map
Tags
Since | 1.0.0 |
Remove an element from the Map object
Tags
Since | 1.0.0 |
Parameters
$key | No description |
Enhance is the compliment of modify. It will only update values if they DON’T already exist.
Tags
Since | 1.2 |
Parameters
$values | mixed | Array or Map of values to add. |
Returns
boolean |
Export all objects/arrays/Maps as an array
If an element is an object it will be checked for an __export() method which if it exists the resulting array from that method will be used as the array representation of the element. If the method does not exist then the resulting array will be an array of the public object member variables only.
Tags
Since | 2.0.0 |
Parameters
$element | No description | |
$export_as_json | boolean | Instead of returning an array, return a JSON string of the array. |
Extend the Map using elements from another Map or Array.
Tags
Since | 1.0.0 |
Parameters
$start_index | No description | |
$num | No description | |
$value | No description |
Find elements based on search criteria
Tags
Since | 1.0.0 |
Parameters
$criteria | No description |
Returns
\Hazaar\Http\Map | A Map of elements that satisfied the search criteria. |
Find a sub element based on search criteria
Tags
Since | 1.0.0 |
Parameters
$criteria | \Hazaar\Http\Map | Search criteria in the format of key => value. |
$field | No description |
Returns
mixed | The first element that matches the criteria |
Parameters
$inner_glue | No description | |
$outer_glue | No description | |
$ignore | No description |
Converts/reduces a single dimensional array with keys in dot-notation and expands it into a multi-dimensional array.
Tags
Since | 2.0.0 |
Parameters
$array | No description | |
$merge | No description |
Returns
array |
Parameters
$json | mixed | No description |
$merge | mixed | No description |
Get a reference to a Map value by key. If an output filters are set they will be executed before the element is returned here. Filters are applied/executed only for element types specified in the ‘out’ filter definition.
Note that when using an output filter the value will NOT be returned by reference meaning in-place modifications will not work.
Tags
Since | 1.0.0 |
Parameters
$key | No description | |
$create | No description |
Returns
mixed | Value at key $key |
Return an array of element value changes that have been made to this Map
Tags
Since | 1.0.0 |
Returns
\Hazaar\Http\Map | An Map of changed elements |
This is useful for getting the original value of a value that has changed. Such as an original index number or other identifier.
Return any new elements in the Map
Tags
Since | 1.0.0 |
Returns
\Hazaar\Http\Map | An map of only new elements in the Map |
Return a list of keys that have been removed
Tags
Since | 1.0.0 |
Returns
\Hazaar\Http\Map | A Map of key names that have been removed from this Map. |
Test if an element exists in the Map object.
Tags
Since | 1.0.0 |
Parameters
$key | No description |
Returns
boolean | True if the element exists, false otherwise. |
Test if there are any changes to this Map object. Changes include not just changes to element values but any new elements added or any elements being removed.
Tags
Since | 1.0.0 |
Returns
boolean | True if there are any changes/additions/removal of elements, false otherwise. |
Test if there are any new elements in the Map
Tags
Since | 1.0.0 |
Returns
boolean | True if there are new elements, false otherwise. |
Test if any values have been removed
Tags
Since | 1.0.0 |
Returns
boolean | True if one or more values have been removed. False otherwise. |
Parameters
$glue | No description |
Searches a numeric keyed array for a value that is contained within it and returns true if it exists.
Tags
Since | 2.0.0 |
Parameters
$value | mixed | The value to search for |
Returns
boolean |
Returns
boolean |
Test if a child value is true NULL. This is the correct way to test for null on a Map object as it will correctly return true for elements that don’t exist.
Tags
Since | 1.0.0 |
Parameters
$key | No description |
Test if an object is a usable Array.
Tags
Since | 1.0.0 |
Parameters
$array | No description |
Returns
boolean | True if the value is an array or extends ArrayAccess |
Return the current key from the Map
Tags
Since | 1.0.0 |
Returns an array of key names currently in this Map object
Lock the map so that it’s values can not be accidentally changed.
Modify multiple elements in one go. Unlike extends this will only modify a value that already exists in the Map.
Tags
Since | 1.0.0 |
Parameters
$values | \Hazaar\Http\Map | Map of values to update. |
Move to the next element in the Map
Tags
Since | 1.0.0 |
Tags
Internal |
Parameters
$key | No description |
Tags
Private |
Parameters
$key | No description |
Tags
Private |
Parameters
$key | No description | |
$value | No description |
Tags
Private |
Parameters
$key | No description |
This will by default pop an element off the end of an array. However this method allows for an element key to be specified which will pop that specific element off the Map.
Tags
Since | 1.0.0 |
Parameters
$key | mixed | Optionally specify the array element to pop off |
Returns
mixed | The element in the last position of the Map |
Populate sets up the array with initial values.
- This can be used to construct the initial array after it has been instatiated.
- It can also be used to reset an array with different values
Input filters are also applied at this point so that default elements can also be modified.
Tags
Since | 1.0.0 |
Parameters
$defaults | mixed | Map or Array of values to initialise the Map with. |
$erase | boolean | If TRUE resets the default values. If FALSE, then the existing defaults are kept but will be overwritten by any new values or created if they do not already exist. Use this to add new default values after the object has been created. |
Push an element on to the end of the Map
Tags
Since | 1.0.0 |
Parameters
$value | No description |
Read will return either the value stored with the specified key, or the default value. This is essentially same as doing:
$value = ($map->has(‘key’)?$map->key:$default);
It has the added benefits however, of being more streamlined and also allowing the value to be
added automatically if it doesn’t exist.Parameters
$key | No description | |
$default | No description | |
$insert | No description |
Remove an element from the Map based on search criteria
Tags
Since | 1.0.0 |
Parameters
$criteria | Array | An array of ssearch criteria that must be met for the element to be removed. |
Returns
boolean | True if something is removed, false otherwise. |
Reset the Map back to its default values
Tags
Since | 1.0.0 |
Parameters
$recursive | No description |
Set the internal pointer the first element
Tags
Since | 1.0.0 |
Parameters
$value | No description |
Set key value. Filters are applied/executed at this point for element types specified in the ‘in’ filter definition.
Tags
Since | 1.0.0 |
Parameters
$key | No description | |
$value | No description | |
$merge_arrays | No description |
Shift an element off of the front of the Map
Tags
Since | 1.0.0 |
Returns
mixed | The element in the first position of the Map |
Return a total of all numeric values in the Map.
Tags
Since | 1.0.0 |
Parameters
$criteria | Array | Search criteria that must be met for the value to be included. |
$fields | Mixed | The fields to use for the sum. If omitted all numeric fields will be summed. If a string is specified then a single field will be used. Also, an Array can be used to allow multiple fields. |
$recursive | boolean | Set true if you need to recurse into child elements and add them to the sum. |
Returns
\Hazaar\Http\float | Sum of all numeric values |
Return the Map as a standard Array
Tags
Since | 1.0.0 |
Parameters
$ignorenulls | No description |
Returns
Array | The Map object as an array |
Converts/reduces a multidimensional array into a single dimensional array with keys in dot-notation.
Tags
Since | 2.0.0 |
Returns
array |
Return a valid JSON string representation of the Map
Tags
Since | 1.0.0 |
Parameters
$ignorenulls | No description | |
$args | No description |
Returns
string | The Map as a JSON string |
Convert the map to a string. This is for compatibility with certain other functions that may attempt to use these objects as a string. If the map contains any elements it will return ‘%Map’, otherwise it will return an empty string.
Tags
Since | 1.0.0 |
Returns
string | A string |
Unlock the map so that it’s values can be changed.
Push an element on to the front of the Map
Tags
Since | 1.0.0 |
Parameters
$value | No description |
This method will update existing values in the current Map object with the values in the supplied $value array or Map. If the values do not already exist in the current Map object, no new values will be created.
Parameters
$values | No description |
Returns
boolean | WIll return False if the supplied parameter is not an array. |
Test that an element exists at the current internal pointer position
Tags
Since | 1.0.0 |