Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
Класс Collection

Открытые статические члены

static sortByColumn (array &$array, $columns, $callbacks='', $defaultValueIfNotSetValue=null, $preserveKeys=false)
 
static firstNotEmpty ()
 
static normalizeArrayValuesByInt (&$map, $sorted=true)
 
static isAssociative (array $array)
 
static clone (array $originalArray)
 
static getByNestedKey (array $array, array $key)
 
static setByNestedKey (array &$array, array $key, $value)
 
static unsetByNestedKey (array &$array, array $key)
 

Подробное описание

См. определение в файле collection.php строка 6

Методы

◆ clone()

static clone ( array $originalArray)
static

Clone array recursively. Keys are preserved

Аргументы
array$originalArray- array to clone
Возвращает
array

См. определение в файле collection.php строка 191

◆ firstNotEmpty()

static firstNotEmpty ( )
static

Takes all arguments by pairs.. Odd arguments are arrays. Even arguments are keys to lookup in these arrays. Keys may be arrays. In this case function will try to dig deeper. Returns first not empty element of a[k] pair.

Аргументы
array$aarray to analyze
string | int$kkey to lookup
mixed$a,...unlimited array/key pairs to go through
Возвращает
mixed|string

См. определение в файле collection.php строка 108

◆ getByNestedKey()

static getByNestedKey ( array $array,
array $key )
static

Returns $array[p1][p2][p3] with $key = [p1, p2, p3]

Аргументы
array$array
array$key
Возвращает
mixed

См. определение в файле collection.php строка 218

◆ isAssociative()

static isAssociative ( array $array)
static

Check array is associative.

Аргументы
$array- Array for check.
Возвращает
bool

См. определение в файле collection.php строка 177

◆ normalizeArrayValuesByInt()

static normalizeArrayValuesByInt ( & $map,
$sorted = true )
static

Convert array values to int, return unique values > 0. Optionally sorted array.

Аргументы
array&$mapArray for normalize.
bool$sortedIf sorted true, result array will be sorted.
Возвращает
void

См. определение в файле collection.php строка 150

◆ setByNestedKey()

static setByNestedKey ( array & $array,
array $key,
$value )
static

Sets value $array[p1][p2][p3] = $value with $key = [p1, p2, p3]

Аргументы
array$array
array$key
$value
Возвращает
void
Исключения
ArgumentException

См. определение в файле collection.php строка 253

◆ sortByColumn()

static sortByColumn ( array & $array,
$columns,
$callbacks = '',
$defaultValueIfNotSetValue = null,
$preserveKeys = false )
static

Sorting array by column. You can use short mode: Collection::sortByColumn($arr, 'value'); This is equal Collection::sortByColumn($arr, array('value' => SORT_ASC))

Pay attention: if two members compare as equal, their relative order in the sorted array is undefined. The sorting is not stable.

More example: Collection::sortByColumn($arr, array('value' => array(SORT_NUMERIC, SORT_ASC), 'attr' => SORT_DESC), array('attr' => 'strlen'), 'www');

Аргументы
array$array
string | array$columns
string | array$callbacks
null$defaultValueIfNotSetValueIf value not set - use $defaultValueIfNotSetValue (any cols)
bool$preserveKeysIf false numeric keys will be re-indexed. If true - preserve.
Исключения

Bitrix\Main\ArgumentOutOfRangeException

См. определение в файле collection.php строка 24

◆ unsetByNestedKey()

static unsetByNestedKey ( array & $array,
array $key )
static

Unsets last key in array $array[p1][p2][p3] with $key = [p1, p2, p3]

Аргументы
array$array
array$key
Возвращает
void
Исключения
ArgumentException

См. определение в файле collection.php строка 284