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 FOFUtilsArray

Fonctions membres publiques statiques

static toInteger (&$array, $default=null)
 
static toObject (&$array, $class='stdClass')
 
static toString ($array=null, $inner_glue='=', $outer_glue=' ', $keepOuterKey=false)
 
static fromObject ($p_obj, $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

A utility class to handle array manipulation.

Based on the JArrayHelper class as found in Joomla! 3.2.0

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

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
FOFUtilsArray::sortObjects()

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
Voir également
http://php.net/manual/en/function.array-unique.php

◆ fromObject()

static fromObject (   $p_obj,
  $recurse = true,
  $regex = null 
)
static

Utility function to map an object to an array

Paramètres
object$p_objThe 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

Références null.

◆ 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

Références $item, et elseif.

Référencé par FOFToolbar\getMyViews().

◆ 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

Références $default, $name, $type, et null.

◆ 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 = FOFUtilsArray::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.

Références $base, $key, et $return.

◆ 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.

◆ 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.

Références $counter, $key, $value, et elseif.

◆ 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 a array of key 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

Références $direction, et null.

Référencé par FOFToolbar\getMyViews(), et FOFFormFieldList\getOptions().

◆ 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

Références $default, $i, elseif, et null.

Référencé par FOFTableNested\copy(), FOFTable\copy(), FOFFormFieldTag\getOptions(), et FOFTable\publish().

◆ toObject()

static toObject ( $array,
  $class = 'stdClass' 
)
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
Renvoie
object The object mapped from the given array

Références $class, et null.

◆ toString()

static toString (   $array = null,
  $inner_glue = '=',
  $outer_glue = ' ',
  $keepOuterKey = false 
)
static

Utility function to map an array to a string.

Paramètres
array$arrayThe array to map.
string$inner_glueThe glue (optional, defaults to '=') between the key and the value.
string$outer_glueThe glue (optional, defaults to ' ') between array elements.
boolean$keepOuterKeyTrue if final key should be kept.
Renvoie
string The string mapped from the given array

Références $item, $key, et $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 :