Support Joomla!

Packages

Package: Joomla-Framework

License

Content on this site is copyright © 2005 - 2008 Open Source Matters Inc and can be used in accordance with the Joomla! Electronic Documentation License. Some parts of this website may be subject to other licenses.

 Class JArrayHelper

Description

JArrayHelper is an array utility class for doing all sorts of odds and ends with arrays.

  • since: 1.5

Located in /joomla/utilities/arrayhelper.php (line 23)

Class JArrayHelper   (Subpackage Utilities)
Method Summary
Static method static array fromObject (object The $p_obj, [boolean $recurse = true], [string $regex = null])
Static method static array getColumn ( &$array, string $index, array $array)
Static method static mixed getValue ( &$array, string $name, [mixed $default = null], [string $type = ''], array $array)
Static method static array sortObjects ( &$a, string $k, [int $direction = 1], array $arr)
Static method static void toInteger ( &$array, [mixed $default = null], array $array)
Static method static object The toObject ( &$array, [ $class = 'stdClass'], array $array, string $calss)
Static method static int _sortObjects ( &$a,  &$b, array $a, array $b)
Method void toString ([ $array = null], [ $inner_glue = '='], [ $outer_glue = ' '], [ $keepOuterKey = false])
Methods
fromObject (line 113)

Utility function to map an object to an array

  • return: The array mapped from the given object
  • since: 1.5
array fromObject (object The $p_obj, [boolean $recurse = true], [string $regex = null])
  • object The $p_obj: source object
  • boolean $recurse: True to recurve through multi-level objects
  • string $regex: An optional regular expression to match on field names
getColumn (line 153)

Extracts a column from an array of arrays or objects

  • return: Column of values from the source array
  • since: 1.5
array getColumn ( &$array, string $index, array $array)
  • array $array: The source array
  • string $index: The index of the column or name of object property
  • &$array
getValue (line 185)

Utility function to return a value from a named array or a specified default

  • return: The value from the source array
  • since: 1.5
mixed getValue ( &$array, string $name, [mixed $default = null], [string $type = ''], array $array)
  • array $array: A named array
  • string $name: The key to search for
  • mixed $default: The default value to give if no key found
  • string $type: Return type for the variable (INT, FLOAT, STRING, WORD, BOOLEAN, ARRAY)
  • &$array
sortObjects (line 253)

Utility function to sort an array of objects on a given field

  • return: The sorted array of objects
  • since: 1.5
array sortObjects ( &$a, string $k, [int $direction = 1], array $arr)
  • array $arr: An array of objects
  • string $k: The key to sort on
  • int $direction: Direction to sort in [1 = Ascending] [-1 = Descending]
  • &$a
toInteger (line 33)

Function to convert array to integer values

  • since: 1.5
void toInteger ( &$array, [mixed $default = null], array $array)
  • array $array: The source array to convert
  • mixed $default: A default value (int|array) to assign if $array is not an array
  • &$array
toObject (line 60)

Utility function to map an array to a stdClass object.

  • return: object mapped from the given array
  • since: 1.5
object The toObject ( &$array, [ $class = 'stdClass'], array $array, string $calss)
  • array $array: The array to map.
  • string $calss: Name of the class to create
  • &$array
  • $class
toString (line 78)
void toString ([ $array = null], [ $inner_glue = '='], [ $outer_glue = ' '], [ $keepOuterKey = false])
  • $array
  • $inner_glue
  • $outer_glue
  • $keepOuterKey
_sortObjects (line 275)

Private callback function for sorting an array of objects on a key

int _sortObjects ( &$a,  &$b, array $a, array $b)
  • array $a: An array of objects
  • array $b: An array of objects
  • &$a
  • &$b

Documentation generated on Sat, 14 Nov 2009 11:10:36 +0000 by phpDocumentor 1.3.1