Joomla CMS  3.10.11 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.10.11 et du framework Joomla Platform intégré
Référence de la classe JArrayHelper

Fonctions membres publiques statiques

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)
 

Fonctions membres protégées statiques

static _fromObject ($item, $recurse, $regex)
 
static _sortObjects ($a, $b)
 

Attributs protégés statiques

static $sortCase
 
static $sortDirection
 
static $sortKey
 
static $sortLocale
 

Description détaillée

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

Documentation des fonctions membres

◆ _fromObject()

static _fromObject (   $item,
  $recurse,
  $regex 
)
staticprotected

Utility function to map an object or array to an array

Paramètres
mixed$itemThe source object or array
boolean$recurseTrue to recurse through multi-level objects
string$regexAn 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$aAn array of objects
array$bAn 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$myArrayThe 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$objectThe source object
boolean$recurseTrue to recurse through multi-level objects
string$regexAn 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&$arrayThe source array
string$indexThe 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&$arrayA named array
string$nameThe key to search for
mixed$defaultThe default value to give if no key found
string$typeReturn 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()

static invert (   $array)
static

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$arrayThe 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$arrayAn 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$sourceThe source array.
string$keyWhere 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&$aAn array of objects
mixed$kThe key (string) or an array of keys to sort on
mixed$directionDirection (integer) or an array of direction to sort in [1 = Ascending] [-1 = Descending]
mixed$caseSensitiveBoolean or array of booleans to let sort occur case sensitive or insensitive
mixed$localeBoolean 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&$arrayThe source array to convert
mixed$defaultA 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&$arrayThe array to map.
string$className of the class to create
boolean$recursiveConvert 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$arrayThe array to map.
string$innerGlueThe glue (optional, defaults to '=') between the key and the value.
string$outerGlueThe glue (optional, defaults to ' ') between array elements.
boolean$keepOuterKeyTrue 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.

Documentation des champs

◆ $sortCase

$sortCase
staticprotected

◆ $sortDirection

$sortDirection
staticprotected

◆ $sortKey

$sortKey
staticprotected

◆ $sortLocale

$sortLocale
staticprotected

La documentation de cette classe a été générée à partir du fichier suivant :