|
static | toInteger (&$array, $default=null) |
|
static | toObject (&$array, $class='stdClass', $recursive=true) |
|
static | toString ($array=null, $innerGlue='=', $outerGlue=' ', $keepOuterKey=false) |
|
static | fromObject ($object, $recurse=true, $regex=null) |
|
static | getColumn (&$array, $index) |
|
static | getValue (&$array, $name, $default=null, $type='') |
|
static | invert ($array) |
|
static | isAssociative ($array) |
|
static | pivot ($source, $key=null) |
|
static | sortObjects (&$a, $k, $direction=1, $caseSensitive=true, $locale=false) |
|
static | arrayUnique ($myArray) |
|
JArrayHelper is an array utility class for doing all sorts of odds and ends with arrays.
- Depuis
- 1.7.0
- Obsolète:
- 4.0 Use Joomla instead
◆ _fromObject()
static _fromObject |
( |
|
$item, |
|
|
|
$recurse, |
|
|
|
$regex |
|
) |
| |
|
staticprotected |
Utility function to map an object or array to an array
- Paramètres
-
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 |
- Renvoie
- array The array mapped from the given object
- Depuis
- 1.7.0
Références $item, et elseif.
◆ _sortObjects()
static _sortObjects |
( |
|
$a, |
|
|
|
$b |
|
) |
| |
|
staticprotected |
Callback function for sorting an array of objects on a key
- Paramètres
-
array | $a | An array of objects |
array | $b | An array of objects |
- Renvoie
- integer Comparison status
- Voir également
- JArrayHelper::sortObjects()
- Depuis
- 1.7.0
Références $b, $count, $direction, $i, et $key.
◆ arrayUnique()
static arrayUnique |
( |
|
$myArray | ) |
|
|
static |
Multidimensional array safe unique test
- Paramètres
-
array | $myArray | The array to make unique. |
- Renvoie
- array
1.7.0 deprecated 505.
◆ fromObject()
static fromObject |
( |
|
$object, |
|
|
|
$recurse = true , |
|
|
|
$regex = null |
|
) |
| |
|
static |
Utility function to map an object to an array
- Paramètres
-
object | $object | The source object |
boolean | $recurse | True to recurse through multi-level objects |
string | $regex | An optional regular expression to match on field names |
- Renvoie
- array The array mapped from the given object
- Depuis
- 1.7.0
- Obsolète:
- 4.0 Use Joomla::fromObject instead
Références null.
Référencé par FOFModel\loadhistory().
◆ getColumn()
static getColumn |
( |
& |
$array, |
|
|
|
$index |
|
) |
| |
|
static |
Extracts a column from an array of arrays or objects
- Paramètres
-
array | &$array | The source array |
string | $index | The index of the column or name of object property |
- Renvoie
- array Column of values from the source array
- Depuis
- 1.7.0
- Obsolète:
- 4.0 Use Joomla::getColumn instead
Référencé par JoomlaupdateModelDefault\isTemplateActive().
◆ getValue()
static getValue |
( |
& |
$array, |
|
|
|
$name, |
|
|
|
$default = null , |
|
|
|
$type = '' |
|
) |
| |
|
static |
Utility function to return a value from a named array or a specified default
- Paramètres
-
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) |
- Renvoie
- mixed The value from the source array
- Depuis
- 1.7.0
- Obsolète:
- 4.0 Use Joomla::getValue instead
Références $default, $name, et $type.
◆ invert()
Takes an associative array of arrays and inverts the array keys to values using the array values as keys.
Example: $input = array( 'New' => array('1000', '1500', '1750'), 'Used' => array('3000', '4000', '5000', '6000') ); $output = JArrayHelper::invert($input);
Output would be equal to: $output = array( '1000' => 'New', '1500' => 'New', '1750' => 'New', '3000' => 'Used', '4000' => 'Used', '5000' => 'Used', '6000' => 'Used' );
- Paramètres
-
array | $array | The source array. |
- Renvoie
- array The inverted array.
- Depuis
- 3.1.4
- Obsolète:
- 4.0 Use Joomla::invert instead
◆ isAssociative()
static isAssociative |
( |
|
$array | ) |
|
|
static |
Method to determine if an array is an associative array.
- Paramètres
-
array | $array | An array to test. |
- Renvoie
- boolean True if the array is an associative array.
- Depuis
- 1.7.0
- Obsolète:
- 4.0 Use Joomla::isAssociative instead
◆ pivot()
static pivot |
( |
|
$source, |
|
|
|
$key = null |
|
) |
| |
|
static |
Pivots an array to create a reverse lookup of an array of scalars, arrays or objects.
- Paramètres
-
array | $source | The source array. |
string | $key | Where the elements of the source array are objects or arrays, the key to pivot on. |
- Renvoie
- array An array of arrays pivoted either on the value of the keys, or an individual key of an object or array.
- Depuis
- 1.7.3
- Obsolète:
- 4.0 Use Joomla::pivot instead
Références $key.
◆ sortObjects()
static sortObjects |
( |
& |
$a, |
|
|
|
$k, |
|
|
|
$direction = 1 , |
|
|
|
$caseSensitive = true , |
|
|
|
$locale = false |
|
) |
| |
|
static |
Utility function to sort an array of objects on a given field
- Paramètres
-
array | &$a | An array of objects |
mixed | $k | The key (string) or an array of keys 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 |
- Renvoie
- array The sorted array of objects
- Depuis
- 1.7.0
- Obsolète:
- 4.0 Use Joomla::sortObjects instead
Références $direction, et null.
◆ toInteger()
static toInteger |
( |
& |
$array, |
|
|
|
$default = null |
|
) |
| |
|
static |
Function to convert array to integer values
- Paramètres
-
array | &$array | The source array to convert |
mixed | $default | A default value (int|array) to assign if $array is not an array |
- Renvoie
- void
- Depuis
- 1.7.0
- Obsolète:
- 4.0 Use Joomla::toInteger instead
Références $default.
◆ toObject()
static toObject |
( |
& |
$array, |
|
|
|
$class = 'stdClass' , |
|
|
|
$recursive = true |
|
) |
| |
|
static |
Utility function to map an array to a stdClass object.
- Paramètres
-
array | &$array | The array to map. |
string | $class | Name of the class to create |
boolean | $recursive | Convert also any array inside the main array |
- Renvoie
- object The object mapped from the given array
- Depuis
- 1.7.0
- Obsolète:
- 4.0 Use Joomla::toObject instead
Références $class, et null.
◆ toString()
static toString |
( |
|
$array = null , |
|
|
|
$innerGlue = '=' , |
|
|
|
$outerGlue = ' ' , |
|
|
|
$keepOuterKey = false |
|
) |
| |
|
static |
Utility function to map an array to a string.
- Paramètres
-
array | $array | The array to map. |
string | $innerGlue | The glue (optional, defaults to '=') between the key and the value. |
string | $outerGlue | The glue (optional, defaults to ' ') between array elements. |
boolean | $keepOuterKey | True if final key should be kept. |
- Renvoie
- string The string mapped from the given array
- Depuis
- 1.7.0
- Obsolète:
- 4.0 Use Joomla::toString instead
Références $output.
◆ $sortCase
◆ $sortDirection
◆ $sortKey
◆ $sortLocale
La documentation de cette classe a été générée à partir du fichier suivant :