WPDK  1.5.0
WordPress Development Kit
 All Data Structures Files Functions Variables Pages
WPDKArray Class Reference
Inheritance diagram for WPDKArray:
WPDKObject

Static Public Member Functions

static insertKeyValuePairs ($arr, $key, $val, $index=0)
 Insert a key value pairs in array. More...
 
static insert (&$arr, $new, $index=0)
 Insert an array in array. More...
 
static prepend ($array, &$dest)
 Prepend an array in array. More...
 
static append ($array, &$dest)
 Prepend an array in array. More...
 
static wrapArray ($array)
 Warp each element of an array with an array. More...
 
static arrayMatch ($array_keys, $array_match)
 Match two array by values. More...
 
static arrayMatchWithValues ($array, $array_match)
 Match two array by values. More...
 
static arrayMatchWithKeys ($array, $array_match)
 Match two array by values. More...
 
static arrayToObject ($array)
 Array to object. More...
 
static objectToArray ($object)
 Object to array. More...
 
static stripKeys ($source, $keeplist)
 Brief. More...
 
static fit ($source, $defaults)
 One to one merge. More...
 
static httpBuildQuery ($formdata, $numeric_prefix=null, $arg_separator=null)
 http_build_query() replacement More...
 
static arrayWithKey ($array_key, $array_extract)
 Return an array for key. More...
 
static arrayExtractByKey ($sourceArray, $arrayKeys)
 Return an array for key. More...
 
- Static Public Member Functions inherited from WPDKObject
static __delta ($last_version, $old_version)
 Object delta compare for combine. More...
 
static delta ($last_version, $old_version)
 
static __dump ($var, $monitor=false)
 Dump a variable. More...
 

Data Fields

 $__version = '1.0.3'
 Version. More...
 
- Data Fields inherited from WPDKObject
 $__version = '1.0.0'
 The version number assigned to the class. More...
 

Additional Inherited Members

- Public Member Functions inherited from WPDKObject
 __className ()
 Returns the class object. More...
 
 __parentClass ()
 Returns the class object for the receiver’s superclass. More...
 
 __isClass ($class)
 Brief. More...
 
 __isSubclassOfClass ($class)
 Return TRUE if the receiving class is a subclass of —or identical to— $class, otherwise FALSE. More...
 

Detailed Description

Array Helper

Overview

The WPDKArray class is an helper that provides a lot of static method for make easy and fast to works with array.

Author
=undo= info@.nosp@m.wpxt.nosp@m.re.me
Date
2014-01-08
Version
1.0.3

Definition at line 16 of file wpdk-array.php.

Member Function Documentation

static append (   $array,
$dest 
)
static

Prepend an array in array.

Append an array or key value pairs array in a destination array. The $dest array is changed.

Parameters
array$arraySource array to prepend
array$destReference to destination array
Note
For key as int see this workround http://stackoverflow.com/a/15413637/205350
Returns
array

Definition at line 101 of file wpdk-array.php.

static arrayExtractByKey (   $sourceArray,
  $arrayKeys 
)
static

Return an array for key.

Return a new key value pairs array with element that match with key of the second array. In other words, if the key of $array_extract is found in keys of $array_key, then that element is catch, else is ignored.

Deprecated:
since 1.4.8
Parameters
array$sourceArrayA source key value pairs array that have to match with a specific key
array$arrayKeysA key value pairs array with the keys to match
Returns
array

Definition at line 349 of file wpdk-array.php.

static arrayMatch (   $array_keys,
  $array_match 
)
static

Match two array by values.

Return a new key value pairs array with element that match with key of the second array. In other words, if the key of $array_match is found in $array_keys, then that element is catch, else is ignored.

Since
1.4.8
Parameters
array$array_keysAn array with the keys for match
array$array_matchA source key value pairs array that have to match with a specific key
Returns
array

Definition at line 138 of file wpdk-array.php.

static arrayMatchWithKeys (   $array,
  $array_match 
)
static

Match two array by values.

This is an alias of WPDKArray::arrayMatch() for key value pairs array

Since
1.4.8
Parameters
array$arrayA key vaues pairs array where the values are used as key for match
array$array_matchA source key value pairs array that have to match with a specific key
Returns
array

Definition at line 176 of file wpdk-array.php.

static arrayMatchWithValues (   $array,
  $array_match 
)
static

Match two array by values.

This is an alias of WPDKArray::arrayMatch() for key value pairs array

Since
1.4.8
Parameters
array$arrayA key vaues pairs array where the values are used as key for match
array$array_matchA source key value pairs array that have to match with a specific key
Returns
array

Definition at line 160 of file wpdk-array.php.

static arrayToObject (   $array)
static

Array to object.

Convert an array into a stdClass()

Parameters
array$arrayThe array we want to convert
Returns
object

Definition at line 194 of file wpdk-array.php.

static arrayWithKey (   $array_key,
  $array_extract 
)
static

Return an array for key.

Return a new key value pairs array with element that match with key of the second array. In other words, if the key of $array_extract is found in keys of $array_key, then that element is catch, else is ignored.

Deprecated:
since 1.4.8
Parameters
array$array_keyA key value pairs array with the keys to match
array$array_extractA source key value pairs array that have to match with a specific key
Note
Well done name and synopsis in arrayExtractByKey()
Returns
array

Definition at line 324 of file wpdk-array.php.

static fit (   $source,
  $defaults 
)
static

One to one merge.

Return a merged array from default and source. If source array has some key miss in defaults array, an unset on that key is performed.

Since
1.3.0
Parameters
array$sourceA key pairs array
array$defaultsA key pairs array with default keys and values
Returns
array

Definition at line 260 of file wpdk-array.php.

static httpBuildQuery (   $formdata,
  $numeric_prefix = null,
  $arg_separator = null 
)
static

http_build_query() replacement

Simulates the behavior of http_build_query() in the previous versions of php 5

Parameters
array$formdataArray $key => $value
null$numeric_prefixSee http_build_query() documentation
null$arg_separatorSee http_build_query() documentation
Returns
string

Definition at line 281 of file wpdk-array.php.

static insert ( $arr,
  $new,
  $index = 0 
)
static

Insert an array in array.

Insert an array or key value pairs array in a second array to a specify index

Parameters
array$arrSource array
array$newNew array
int$indexOptional. Index zero base
Note
For key as int see this workround http://stackoverflow.com/a/15413637/205350
$input = array("red", "green", "blue", "yellow");
array_splice($input, 2);
// $input is now array("red", "green")
Returns
array

Definition at line 63 of file wpdk-array.php.

static insertKeyValuePairs (   $arr,
  $key,
  $val,
  $index = 0 
)
static

Insert a key value pairs in array.

Insert a key => value into a second array to a specify index

Parameters
array$arrSource array
string$keyKey
mixed$valValue
int$indexOptional. Index zero base
Returns
array

Definition at line 39 of file wpdk-array.php.

static objectToArray (   $object)
static

Object to array.

Convert a object to an array

Parameters
object$objectThe object we want to convert
Returns
array

Definition at line 215 of file wpdk-array.php.

static prepend (   $array,
$dest 
)
static

Prepend an array in array.

Prepend an array or key value pairs array in a destination array. The $dest array is changed.

Parameters
array$arraySource array to prepend
array$destReference to destination array
Note
For key as int see this workround http://stackoverflow.com/a/15413637/205350
Returns
array

Definition at line 83 of file wpdk-array.php.

static stripKeys (   $source,
  $keeplist 
)
static

Brief.

Return a key pairs array start from source without the keys not present in keeplist

Since
1.3.0
Parameters
array$sourceSource key pairs array
array$keeplistKey pairs array with the list of key to keep
Returns
mixed

Definition at line 237 of file wpdk-array.php.

static wrapArray (   $array)
static

Warp each element of an array with an array.

Warp each element of an array with an array

Note
Prototype
Parameters
array$arrayAn array
Returns
array

Definition at line 117 of file wpdk-array.php.

Field Documentation

string $__version = '1.0.3'

Version.

Override version

Definition at line 25 of file wpdk-array.php.


The documentation for this class was generated from the following file: