Skip to content

Commit

Permalink
https://github.com/mage2pro/core/issues/403
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Jun 3, 2024
1 parent 1d5ad7a commit a218c56
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/code/local/Df/Core/lib/array/select.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@
* array_column() misses the keys: https://3v4l.org/llMrL
* df_column() preserves the keys.
* 2024-05-14 "Port `df_column()` from `mage2pro/core`": https://github.com/thehcginstitute-com/m1/issues/601
* 2024-06-03
* 1) "Use the `iterable` type": https://github.com/mage2pro/core/issues/403
* 2) `iterable` is supported by PHP ≥ 7.1: https://3v4l.org/qNX1j
* 3) https://php.net/manual/en/language.types.iterable.php
* @used-by df_index()
* @used-by df_product_images_additional()
* @param Traversable|array(int|string => _DO|array(string => mixed)) $c
* @param string|Closure $fv
* @param string|null $fk [optional]
* @return array(int|string => mixed)
*/
function df_column($c, $fv, $fk = null):array {return df_map_kr($c, function($k, $v) use($fv, $fk) {return [
function df_column(iterable $c, $fv, $fk = null):array {return df_map_kr($c, function($k, $v) use($fv, $fk):array {return [
!$fk ? $k : df_call($v, $fk), df_call($v, $fv)
];});}

Expand Down

0 comments on commit a218c56

Please sign in to comment.