|
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) |
|
A utility class to handle array manipulation.
Based on the JArrayHelper class as found in Joomla! 3.2.0
◆ _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
Références $item, et elseif.
◆ _sortObjects()
static _sortObjects |
( |
& |
$a, |
|
|
& |
$b |
|
) |
| |
|
staticprotected |
◆ arrayUnique()
static arrayUnique |
( |
|
$myArray | ) |
|
|
static |
◆ fromObject()
static fromObject |
( |
|
$p_obj, |
|
|
|
$recurse = true , |
|
|
|
$regex = null |
|
) |
| |
|
static |
Utility function to map an object to an array
- Paramètres
-
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 |
- 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 | &$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
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 | &$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
Références $default, $name, $type, et null.
◆ 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 = 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 | $array | The 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 | $array | An 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 | $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.
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 | &$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 |
- 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 |
◆ toObject()
static toObject |
( |
& |
$array, |
|
|
|
$class = 'stdClass' |
|
) |
| |
|
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 |
- 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 | $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. |
- Renvoie
- string The string mapped from the given array
Références $item, $key, et $output.
◆ $sortCase
◆ $sortDirection
◆ $sortKey
◆ $sortLocale
La documentation de cette classe a été générée à partir du fichier suivant :