Class JArrayHelper

Description

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

  • since: 11.1

Located in /libraries/joomla/utilities/arrayhelper.php (line 19)


	
			
Variable Summary
static mixed $sortCase
static mixed $sortDirection
static string $sortKey
static mixed $sortLocale
Method Summary
static array arrayUnique (array $myArray)
static array fromObject (object $p_obj, [boolean $recurse = true], [string $regex = null])
static array getColumn (array &$array, string $index)
static mixed getValue (array &$array, string $name, [mixed $default = null], [string $type = ''])
static boolean isAssociative (array $array)
static array sortObjects (array &$a, mixed $k, [mixed $direction = 1], [mixed $caseSensitive = true], [mixed $locale = false])
static void toInteger (array &$array, [mixed $default = null])
static object The toObject (array &$array, [string $class = 'stdClass'])
static string toString ([array $array = null], [string $inner_glue = '='], [string $outer_glue = ' '], [boolean $keepOuterKey = false])
static array _fromObject (mixed $item, boolean $recurse, string $regex)
static integer _sortObjects (array &$a, array &$b)
array pivot (array $source, [string $key = null])
Variables
static mixed $sortCase (line 27)

Option to perform case-sensitive sorts.

  • var: Boolean or array of booleans.
  • since: 11.3
  • access: protected
static mixed $sortDirection (line 35)

Option to set the sort direction.

  • var: Integer or array of integers.
  • since: 11.3
  • access: protected
static string $sortKey (line 43)

Option to set the object key to sort on.

  • since: 11.3
  • access: protected
static mixed $sortLocale (line 51)

Option to perform a language aware sort.

  • var: Boolean or array of booleans.
  • since: 11.3
  • access: protected
Methods
static method arrayUnique (line 546)

Multidimensional array safe unique test

static array arrayUnique (array $myArray)
  • array $myArray: The array to make unique.
static method fromObject (line 171)

Utility function to map an object to an array

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

Extracts a column from an array of arrays or objects

  • return: Column of values from the source array
  • since: 11.1
  • access: public
static array getColumn (array &$array, string $index)
  • array &$array: The source array
  • string $index: The index of the column or name of object property
static method getValue (line 277)

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

  • return: The value from the source array
  • since: 11.1
  • access: public
static mixed getValue (array &$array, string $name, [mixed $default = null], [string $type = ''])
  • 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)
static method isAssociative (line 347)

Method to determine if an array is an associative array.

  • return: True if the array is an associative array.
  • since: 11.1
  • access: public
static boolean isAssociative (array $array)
  • array $array: An array to test.
static method sortObjects (line 451)

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

  • return: The sorted array of objects
  • since: 11.1
  • access: public
static array sortObjects (array &$a, mixed $k, [mixed $direction = 1], [mixed $caseSensitive = true], [mixed $locale = false])
  • array &$a: An array of objects
  • mixed $k: The key (string) or a array of key to sort on
  • mixed $direction: Direction (integer) or an array of direction to sort in [1 = Ascending] [-1 = Descending]
  • mixed $caseSensitive: Boolean or array of booleans to let sort occur case sensitive or insensitive
  • mixed $locale: Boolean or array of booleans to let sort occur using the locale language or not
static method toInteger (line 63)

Function to convert array to integer values

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

Utility function to map an array to a stdClass object.

  • return: object mapped from the given array
  • since: 11.1
  • access: public
static object The toObject (array &$array, [string $class = 'stdClass'])
  • array &$array: The array to map.
  • string $class: Name of the class to create
static method toString (line 133)

Utility function to map an array to a string.

  • return: The string mapped from the given array
  • since: 11.1
  • access: public
static string toString ([array $array = null], [string $inner_glue = '='], [string $outer_glue = ' '], [boolean $keepOuterKey = false])
  • array $array: The array to map.
  • string $inner_glue: The glue (optional, defaults to '=') between the key and the value.
  • string $outer_glue: The glue (optional, defaults to ' ') between array elements.
  • boolean $keepOuterKey: True if final key should be kept.
static method _fromObject (line 194)

Utility function to map an object or array to an array

  • return: The array mapped from the given object
  • since: 11.1
  • access: protected
static array _fromObject (mixed $item, boolean $recurse, string $regex)
  • mixed $item: The source object or array
  • boolean $recurse: True to recurse through multi-level objects
  • string $regex: An optional regular expression to match on field names
static method _sortObjects (line 484)

Callback function for sorting an array of objects on a key

static integer _sortObjects (array &$a, array &$b)
  • array &$a: An array of objects
  • array &$b: An array of objects
pivot (line 373)

Pivots an array to create a reverse lookup of an array of scalars, arrays or objects.

  • return: An array of arrays pivoted either on the value of the keys, or an individual key of an object or array.
  • since: 11.3
  • access: public
array pivot (array $source, [string $key = null])
  • array $source: The source array.
  • string $key: Where the elements of the source array are objects or arrays, the key to pivot on.

Documentation generated on Mon, 25 Jun 2012 13:52:15 -0500 by phpDocumentor 1.4.4