/var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/cakephp/src/Collection
NameSizeModeActions
Iterator/-0755rm
Collection.php32190644editdlrm
CollectionInterface.php424270644editdlrm
CollectionTrait.php283640644editdlrm
composer.json9560644editdlrm
ExtractTrait.php44450644editdlrm
functions.php10880644editdlrm
LICENSE.txt12040644editdlrm
README.md11770644editdlrm
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/cakephp/src/Collection/ExtractTrait.php (4445B)
_extract($element, $parts); }; } return function ($element) use ($parts) { return $this->_simpleExtract($element, $parts); }; } /** * 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 `{*}` * * @param \ArrayAccess|array $data Data. * @param array $parts Path to extract from. * @return mixed */ protected function _extract($data, array $parts) { $value = null; $collectionTransform = false; foreach ($parts as $i => $column) { if ($column === '{*}') { $collectionTransform = true; continue; } if ( $collectionTransform && !( $data instanceof Traversable || is_array($data) ) ) { return null; } if ($collectionTransform) { $rest = implode('.', array_slice($parts, $i)); return (new Collection($data))->extract($rest); } if (!isset($data[$column])) { return null; } $value = $data[$column]; $data = $value; } return $value; } /** * Returns a column from $data that can be extracted * by iterating over the column names contained in $path * * @param \ArrayAccess|array $data Data. * @param array $parts Path to extract from. * @return mixed */ protected function _simpleExtract($data, array $parts) { $value = null; foreach ($parts as $column) { if (!isset($data[$column])) { return null; } $value = $data[$column]; $data = $value; } return $value; } /** * Returns a callable that receives a value and will return whether * it matches certain condition. * * @param 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. * @return \Closure */ protected function _createMatcherFilter(array $conditions): Closure { $matchers = []; foreach ($conditions as $property => $value) { $extractor = $this->_propertyExtractor($property); $matchers[] = function ($v) use ($extractor, $value) { return $extractor($v) == $value; }; } return function ($value) use ($matchers) { foreach ($matchers as $match) { if (!$match($value)) { return false; } } return true; }; } }