Trait ExtractTrait
Provides utility protected methods for extracting a property or column from an array or object.
Direct Users
Method Summary
-
_createMatcherFilter() protected
Returns a callable that receives a value and will return whether or not it matches certain condition.
-
_extract() protected
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
{*}
-
_propertyExtractor() protected
Returns a callable that can be used to extract a property or column from an array or object based on a dot separated path.
-
_simpleExtract() protected
Returns a column from $data that can be extracted by iterating over the column names contained in $path
Method Detail
_createMatcherFilter() protected ¶
_createMatcherFilter( array $conditions )
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
_extract() protected ¶
_extract( array|ArrayAccess $data , array $path )
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
_propertyExtractor() protected ¶
_propertyExtractor( string|callable $callback )
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
_simpleExtract() protected ¶
_simpleExtract( array|ArrayAccess $data , array $path )
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.