\Cake\CollectionExtractTrait

Provides utility protected methods for extracting a property or column from an array or object.

Summary

Methods
Properties
Constants
No public methods found
No public properties found
No constants found
_propertyExtractor()
_extract()
_simpleExtract()
_createMatcherFilter()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

_propertyExtractor()

_propertyExtractor(string|callable  $callback) : callable

Returns a callable that can be used to extract a property or column from an array or object based on a dot separated path.

Parameters

string|callable $callback

A dot separated path of column to follow so that the final one can be returned or a callable that will take care of doing that.

Returns

callable

_extract()

_extract(array|\ArrayAccess  $data, array  $path) : mixed

Returns a column from $data that can be extracted by iterating over the column names contained in $path.

It will return arrays for elements in represented with {*}

Parameters

array|\ArrayAccess $data

Data.

array $path

Path to extract from.

Returns

mixed

_simpleExtract()

_simpleExtract(array|\ArrayAccess  $data, array  $path) : mixed

Returns a column from $data that can be extracted by iterating over the column names contained in $path

Parameters

array|\ArrayAccess $data

Data.

array $path

Path to extract from.

Returns

mixed

_createMatcherFilter()

_createMatcherFilter(array  $conditions) : callable

Returns a callable that receives a value and will return whether or not it matches certain condition.

Parameters

array $conditions

A key-value list of conditions to match where the key is the property path to get from the current item and the value is the value to be compared the item with.

Returns

callable