helpers\BaseConsole ansiStrlen()

ansiStrlen() public static method Returns the length of the string without ANSI color codes. public static integer ansiStrlen ( $string )$string string The string to measure return integer The length of the string not counting ANSI format characters

helpers\BaseConsole ansiFormatCode()

ansiFormatCode() public static method Returns the ANSI format code. public static string ansiFormatCode ( $format )$format array An array containing formatting values. You can pass any of the FG_*, BG_* and TEXT_* constants and also xtermFgColor() and xtermBgColor() to specify a format. return string The ANSI format code according to the given formatting constants.

helpers\BaseConsole ansiFormat()

ansiFormat() public static method Will return a string formatted with the given ANSI style public static string ansiFormat ( $string, $format = [] )$string string The string to be formatted $format array An array containing formatting values. You can pass any of the FG_*, BG_* and TEXT_* constants and also xtermFgColor() and xtermBgColor() to specify a format.

helpers\BaseArrayHelper toArray()

toArray() public static method Converts an object or an array of objects into an array. public static array toArray ( $object, $properties = [], $recursive = true )$object object|array|string The object to be converted into an array $properties array A mapping from object class names to the properties that need to put into the resulting arrays. The properties specified for each class is an array of the following format: [ 'app\models\Post' => [ 'id', 'title',

helpers\BaseArrayHelper remove()

remove() public static method Removes an item from an array and returns the value. If the key does not exist in the array, the default value will be returned instead. Usage examples, // $array = ['type' => 'A', 'options' => [1, 2]]; // working with array $type = \yii\helpers\ArrayHelper::remove($array, 'type'); // $array content // $array = ['options' => [1, 2]]; public static mixed|null remove ( &$array, $key, $default = null )$array array The array to extract value from

helpers\BaseArrayHelper multisort()

multisort() public static method Sorts an array of objects or arrays (with the same structure) by one or several keys. public static void multisort ( &$array, $key, $direction = SORT_ASC, $sortFlag = SORT_REGULAR )$array array The array to be sorted. The array will be modified after calling this method. $key string|Closure|array The key(s) to be sorted by. This refers to a key name of the sub-array elements, a property name of the objects, or an anonymous function returning the v

helpers\BaseArrayHelper merge()

merge() public static method Merges two or more arrays into one recursively. If each array has an element with the same string key value, the latter will overwrite the former (different from array_merge_recursive). Recursive merging will be conducted if both arrays have an element of array type and are having the same key. For integer-keyed elements, the elements from the latter array will be appended to the former array. You can use yii\helpers\UnsetArrayValue object to unset value from pr

helpers\BaseArrayHelper map()

map() public static method Builds a map (key-value pairs) from a multidimensional array or an array of objects. The $from and $to parameters specify the key names or property names to set up the map. Optionally, one can further group the map according to a grouping field $group. For example, $array = [ ['id' => '123', 'name' => 'aaa', 'class' => 'x'], ['id' => '124', 'name' => 'bbb', 'class' => 'x'], ['id' => '345', 'name' => 'ccc', 'class' => 'y'], ];

helpers\BaseArrayHelper keyExists()

keyExists() public static method Checks if the given array contains the specified key. This method enhances the array_key_exists() function by supporting case-insensitive key comparison. public static boolean keyExists ( $key, $array, $caseSensitive = true )$key string The key to check $array array The array with keys to check $caseSensitive boolean Whether the key comparison should be case-sensitive return boolean Whether the array contains the specified key

helpers\BaseArrayHelper isTraversable()

isTraversable() public static method (available since version 2.0.8) Checks whether a variable is an array or Traversable. This method does the same as the PHP function is_array() but additionally works on objects that implement the Traversable interface. See also http://php.net/manual/en/function.is_array.php. public static boolean isTraversable ( $var )$var mixed The variable being evaluated. return boolean Whether $var is array-like