include/utils/array_utils.php

Show: inherited
Table of Contents

Functions

functionadd_blank_option(  $options ) : void

Parameters
Name Type Description
$options
functionarray_merge_values(  $arr1,  $arr2 ) : void

Parameters
Name Type Description
$arr1
$arr2
functionarray_search_insensitive( \unknown_type $key, \unknown_type $haystack ) : void

Search an array for a given value ignorning case sensitivity

Parameters
Name Type Description
$key \unknown_type
$haystack \unknown_type
functiondeepArrayDiff(  $array1,  $array2,  $allowEmpty = false ) : array

This function returns an array of all the key=>value pairs in $array1 that are wither not present, or different in $array2.

If a key exists in $array2 but not $array1, it will not be reported. Values which are arrays are traced further and reported only if thier is a difference in one or more of thier children.

Parameters
Name Type Description
$array1
$array2
$allowEmpty
Returns
Type Description
array containing the differences between the two arrays
functionobject_to_array_recursive(  $obj ) : array

This function will attempt to convert an object to an array.

Loops are not checked for so this function should be used with caution.

Parameters
Name Type Description
$obj
Returns
Type Description
array representation of $obj
functionoverride_recursive_helper(  $key_names,  $array_name,  $value ) : void

Parameters
Name Type Description
$key_names
$array_name
$value
functionoverride_value_to_string(  $array_name,  $value_name,  $value ) : void

Parameters
Name Type Description
$array_name
$value_name
$value
functionoverride_value_to_string_recursive(  $key_names,  $array_name,  $value,  $eval = false ) : void

Parameters
Name Type Description
$key_names
$array_name
$value
$eval
functionoverride_value_to_string_recursive2(  $array_name,  $value_name,  $value,  $save_empty = true ) : void

Parameters
Name Type Description
$array_name
$value_name
$value
$save_empty
functionsetDeepArrayValue( \unknown_type $array, \unknown_type $key,  $value ) : void

Recursivly set a value in an array, creating sub arrays as necessary

Parameters
Name Type Description
$array \unknown_type
$key \unknown_type
$value
functionvar_export_helper(  $tempArray ) : void

Parameters
Name Type Description
$tempArray

\SugarArray

Package: SugarCRM

Wrapper around PHP's ArrayObject class that provides dot-notation recursive searching for multi-dimensional arrays

Parent(s)
\ArrayObject

Methods

methodprivate_getFromSource(  $key,  $default ) : void

Parameters
Name Type Description
$key
$default
methodprivate_getRecursive(  $raw_config,  $children,  $default ) : void

Parameters
Name Type Description
$raw_config
$children
$default
methodpublicget( string $key, mixed $default = null ) : mixed

Return the value matching $key if exists, otherwise $default value

This method uses dot notation to look through multi-dimensional arrays

Parameters
Name Type Description
$key string

key to look up

$default mixed

value to return if $key does not exist

Returns
Type Description
mixed
methodpublicstaticGet( array $haystack, string $needle, mixed $default = null ) : mixed
static

Provided as a convinience method for fetching a value within an existing array without instantiating a SugarArray

NOTE: This should only used where refactoring an array into a SugarArray is unfeasible. This operation is more expensive than a direct SugarArray as each time it creates and throws away a new instance

Parameters
Name Type Description
$haystack array

haystack

$needle string

needle

$default mixed

default value to return

Returns
Type Description
mixed
Documentation was generated by DocBlox 0.18.1.