Transform
in package
Transformation algorithms
Table of Contents
- arrayToKeyValue() : callable
- Method creates algorithm wich converts array of records to key-value pairs
- convert() : void
- Method converts one array to another
- convertElements() : void
- Method converts one array to another
- filter() : void
- Method filters
- hashByField() : array<string|int, array<string|int, mixed>>
- Method creates hash ffrom list of records by their field value
Methods
arrayToKeyValue()
Method creates algorithm wich converts array of records to key-value pairs
public
static arrayToKeyValue(string $keyFieldName, string $valueFieldName) : callable
Parameters
- $keyFieldName : string
-
name of the key field
- $valueFieldName : string
-
name of the value field
Return values
callable —[$key, $value]
convert()
Method converts one array to another
public
static convert(array<string|int, mixed> &$records, callable $converter) : void
Parameters
- $records : array<string|int, mixed>
-
records to be converted
- $converter : callable
Tags
Return values
void —convertElements()
Method converts one array to another
public
static convertElements(array<string|int, mixed> &$records, callable $converter) : void
Parameters
- $records : array<string|int, mixed>
-
records to be converted
- $converter : callable
Tags
Return values
void —filter()
Method filters
public
static filter(array<string|int, mixed> &$records, callable $filter) : void
Parameters
- $records : array<string|int, mixed>
- $filter : callable
-
filtration fuction
Return values
void —hashByField()
Method creates hash ffrom list of records by their field value
public
static hashByField(array<string|int, array<string|int, mixed>>|array<string|int, object> $data, string $field) : array<string|int, array<string|int, mixed>>
Parameters
- $data : array<string|int, array<string|int, mixed>>|array<string|int, object>
-
origin array of records
- $field : string
-
field name
Return values
array<string|int, array<string|int, mixed>> —hash