Overview

Packages

  • bootstrap
    • behaviors
    • components
    • form
    • gii
    • helpers
    • widgets

Classes

  • TbArray
  • TbHtml
  • Overview
  • Package
  • Class
  • Tree

Class TbArray

Array helper class.

Package: bootstrap\helpers
Copyright: Copyright © Christoffer Niska 2013-
License: New BSD License
Author: Christoffer Niska <christoffer.niska@gmail.com>
Located at helpers/TbArray.php
Methods summary
public static mixed
# getValue( string $key, array $array, mixed $defaultValue = null )

Returns a specific value from the given array (or the default value if not set).

Returns a specific value from the given array (or the default value if not set).

Parameters

$key
string
$key the item key.
$array
array
$array the array to get from.
$defaultValue
mixed
$defaultValue the default value.

Returns

mixed
the value.
public static mixed
# popValue( string $key, array & $array, mixed $defaultValue = null )

Removes and returns a specific value from the given array (or the default value if not set).

Removes and returns a specific value from the given array (or the default value if not set).

Parameters

$key
string
$key the item key.
$array
array
$array the array to pop the item from.
$defaultValue
mixed
$defaultValue the default value.

Returns

mixed
the value.
public static
# defaultValue( string $key, mixed $value, array & $array )

Sets the default value for a specific key in the given array.

Sets the default value for a specific key in the given array.

Parameters

$key
string
$key the item key.
$value
mixed
$value the default value.
$array
array
$array the array.
public static
# defaultValues( array $values, array & $array )

Sets a set of default values for the given array.

Sets a set of default values for the given array.

Parameters

$values
array
$array the array to set values for.
$array
array
$values the default values.
public static
# removeValue( string $key, array & $array )

Removes a specific value from the given array.

Removes a specific value from the given array.

Parameters

$key
string
$key the item key.
$array
public static
# removeValues( array $keys, array & $array )

Removes a set of items from the given array.

Removes a set of items from the given array.

Parameters

$keys
array
$keys the keys to remove.
$array
array
$array the array to remove from.
public static array
# copyValues( array $keys, array $from, array $to, boolean $force = false )

Copies the given values from one array to another.

Copies the given values from one array to another.

Parameters

$keys
array
$keys the keys to copy.
$from
array
$from the array to copy from.
$to
array
$to the array to copy to.
$force
boolean
$force whether to allow overriding of existing values.

Returns

array
the options.
public static array
# moveValues( array $keys, array & $from, array $to, boolean $force = false )

Moves the given values from one array to another.

Moves the given values from one array to another.

Parameters

$keys
array
$keys the keys to move.
$from
array
$from the array to move from.
$to
array
$to the array to move to.
$force
boolean
$force whether to allow overriding of existing values.

Returns

array
the options.
public static array
# merge( array $to, array $from )

Merges two arrays.

Merges two arrays.

Parameters

$to
array
$to array to be merged to.
$from
array
$from array to be merged from.

Returns

array
the merged array.
Yiistrap API documentation generated by ApiGen 2.8.0