\Hazaar\Http
Request
Summary
Methods Properties Constants
del
get
has
in
key
pop
set
sum
No constants
Properties
$body
$body
$fsock_host
$fsock_host
$headers
$headers
$method
$method
$raw_uri
$raw_uri
$uri
$uri
Methods
__construct()
__construct($uri = null, $method = 'GET', $content_type = null)

Parameters

$uri

No description

$method

No description

$content_type

No description

addMultipart()
addMultipart($data, $content_type = null)

Parameters

$data

No description

$content_type

No description

authorisation()
authorisation($user, $type = null)

Parameters

$user

No description

$type

No description

authorise()
authorise($username, $password, $method = 'basic')

Parameters

$username

No description

$password

No description

$method

No description

authorization()
authorization($user, $type = 'Bearer')

Parameters

$user

No description

$type

No description

getBody()
getBody()
getHeader()
getHeader($key)

Parameters

$key

No description

setBody()
setBody($body)

Parameters

$body

No description

setHeader()
setHeader($key, $value)

Parameters

$key

No description

$value

No description

toString()
toString()
useCookie()
useCookie($cookie)

Parameters

$cookie

No description

Inherited
commit()
commit($recursive = true) : boolean

Commit any changes to be the new default values

Tags

Since

1.0.0

Parameters

$recursiveboolean

Recurse through any child Map objects and also commit them.

Returns

boolean

True on success. False otherwise.

Inherited
count()
count($ignorenulls = false) : int

Countable interface method. This method is called when a call to count() is made on this object.

Tags

Since

1.0.0

Parameters

$ignorenulls

No description

Returns

int

The number of elements in this Map.

Inherited
current()
current()

Return the current element in the Map

Tags

Since

1.0.0

Inherited
del()
del($key)

Remove an element from the Map object

Tags

Since

1.0.0

Parameters

$key

No description

Inherited
enhance()
enhance($values) : boolean

Enhance is the compliment of modify. It will only update values if they DON’T already exist.

Tags

Since

1.2

Parameters

$valuesmixed

Array or Map of values to add.

Returns

boolean
InheritedStatic
exportAll()
exportAll($element, $export_as_json = false)

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_jsonboolean

Instead of returning an array, return a JSON string of the array.

Inherited
extend()
extend()

Extend the Map using elements from another Map or Array.

Tags

Since

1.0.0

Inherited
fill()
fill($start_index, $num, $value)

Parameters

$start_index

No description

$num

No description

$value

No description

Inherited
find()
find($criteria) : Map

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.

Inherited
findOne()
findOne($criteria, $field = null) : mixed

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

Inherited
flatten()
flatten($inner_glue = '=', $outer_glue = ' ', $ignore = Array ( ) )

Parameters

$inner_glue

No description

$outer_glue

No description

$ignore

No description

Inherited
fromDotNotation()
fromDotNotation($array, $merge = false) : array
Convert to Map from dot notation

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
Inherited
fromJSON()
fromJSON($json, $merge = false)
Populate or extend the object values from a JSON string

Parameters

$jsonmixed

No description

$mergemixed

No description

Inherited
get()
get($key) : mixed

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

Returns

mixed

Value at key $key

Inherited
getChanges()
getChanges() : Map

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

Inherited
getDefault()
getDefault($key) : bool
Get the default value for a value stored in the Map object.

This is useful for getting the original value of a value that has changed. Such as an original index number or other identifier.

Parameters

$key

No description

Returns

\Hazaar\Http\bool
Inherited
getNew()
getNew() : Map

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

Inherited
getRemoves()
getRemoves() : 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.

Inherited
has()
has($key) : boolean

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.

Inherited
hasChanges()
hasChanges() : boolean

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.

Inherited
hasNew()
hasNew() : boolean

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.

Inherited
hasRemoves()
hasRemoves() : boolean

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.

Inherited
implode()
implode($glue = ' ')

Parameters

$glue

No description

Inherited
in()
in($value) : boolean

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

$valuemixed

The value to search for

Returns

boolean
Inherited
isEmpty()
isEmpty() : boolean
Check whether the map object is empty or not.

Returns

boolean
Inherited
isNull()
isNull($key)

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

InheritedStatic
is_array()
is_array($array) : boolean

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

Inherited
key()
key()

Return the current key from the Map

Tags

Since

1.0.0

Inherited
keys()
keys()

Returns an array of key names currently in this Map object

Inherited
lock()
lock()

Lock the map so that it’s values can not be accidentally changed.

Inherited
modify()
modify($values)

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.

Inherited
next()
next()

Move to the next element in the Map

Tags

Since

1.0.0

Inherited
offsetExists()
offsetExists($key)

Tags

Internal

Parameters

$key

No description

Inherited
offsetGet()
offsetGet($key)

Tags

Private

Parameters

$key

No description

Inherited
offsetSet()
offsetSet($key, $value)

Tags

Private

Parameters

$key

No description

$value

No description

Inherited
offsetUnset()
offsetUnset($key)

Tags

Private

Parameters

$key

No description

Inherited
pop()
pop() : mixed

Pop an element off of the end of the Map

Tags

Since

1.0.0

Returns

mixed

The element in the last position of the Map

Inherited
populate()
populate($defaults, $erase = true)

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.

This method will overwrite ALL values currently in the Map.

Tags

Since

1.0.0

Parameters

$defaultsmixed

Map or Array of values to initialise the Map with.

$eraseboolean

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.

Inherited
push()
push($value)

Push an element on to the end of the Map

Tags

Since

1.0.0

Parameters

$value

No description

Inherited
read()
read($key, $default, $insert = false)

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

Inherited
remove()
remove($criteria) : boolean

Remove an element from the Map based on search criteria

Tags

Since

1.0.0

Parameters

$criteriaArray

An array of ssearch criteria that must be met for the element to be removed.

Returns

boolean

True if something is removed, false otherwise.

Inherited
reset()
reset($recursive = false)

Reset the Map back to its default values

Tags

Since

1.0.0

Parameters

$recursive

No description

Inherited
rewind()
rewind()

Set the internal pointer the first element

Tags

Since

1.0.0

Inherited
search()
search($value)

Parameters

$value

No description

Inherited
set()
set($key, $value, $merge_arrays = false)

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

Inherited
shift()
shift() : mixed

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

Inherited
sum()
sum($criteria = null, $fields = Array ( ) , $recursive = false) : float

Return a total of all numeric values in the Map.

Tags

Since

1.0.0

Parameters

$criteriaArray

Search criteria that must be met for the value to be included.

$fieldsMixed

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.

$recursiveboolean

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

Inherited
toArray()
toArray($ignorenulls = false) : Array

Return the Map as a standard Array

Tags

Since

1.0.0

Parameters

$ignorenulls

No description

Returns

Array

The Map object as an array

Inherited
toDotNotation()
toDotNotation() : array
Convert to dot notation

Converts/reduces a multidimensional array into a single dimensional array with keys in dot-notation.

Tags

Since

2.0.0

Returns

array
Inherited
toJSON()
toJSON($ignorenulls = false, $args = null) : string

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

Inherited
toString()
toString() : 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

Inherited
unlock()
unlock()

Unlock the map so that it’s values can be changed.

Inherited
unshift()
unshift($value)

Push an element on to the front of the Map

Tags

Since

1.0.0

Parameters

$value

No description

Inherited
update()
update($values) : boolean
Updates the Map with values in the supplied array if they exist

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.

Inherited
valid()
valid()

Test that an element exists at the current internal pointer position

Tags

Since

1.0.0