@@ -47,13 +47,17 @@ elements, you can use attribute matching with certain methods. They are `extract
4747| ` [id<=2] ` | Match elements with id less than or equal to 2. |
4848| ` [text=/.../] ` | Match elements that have values matching the regular expression inside ` ... ` . |
4949
50+ ### Hash::get()
51+
5052` static ` Cake\\ Utility\\ Hash::** get** (array|ArrayAccess $data, $path, $default = null)
5153
5254` get() ` is a simplified version of ` extract() ` , it only supports direct
5355path expressions. Paths with ` {n} ` , ` {s} ` , ` {*} ` or matchers are not
5456supported. Use ` get() ` when you want exactly one value out of an array. If
5557a matching path is not found the default value will be returned.
5658
59+ ### Hash::extract()
60+
5761` static ` Cake\\ Utility\\ Hash::** extract** (array|ArrayAccess $data, $path)
5862
5963` Hash::extract() ` supports all expression, and matcher components of
@@ -124,9 +128,11 @@ $result = Hash::insert($data, '{n}[up].Item[id=4].new', 9);
124128*/
125129```
126130
131+ ### Hash::remove()
132+
127133` static ` Cake\\ Utility\\ Hash::** remove** (array $data, $path)
128134
129- Removes all elements from an array that match ` $path ` . :
135+ Removes all elements from an array that match ` $path ` :
130136
131137``` php
132138$a = [
@@ -167,13 +173,15 @@ $result = Hash::remove($data, '{n}[clear].Item[id=4]');
167173*/
168174```
169175
176+ ### Hash::combine()
177+
170178` static ` Cake\\ Utility\\ Hash::** combine** (array $data, $keyPath, $valuePath = null, $groupPath = null)
171179
172180Creates an associative array using a ` $keyPath ` as the path to build its keys,
173181and optionally ` $valuePath ` as path to get the values. If ` $valuePath ` is not
174182specified, or doesn't match anything, values will be initialized to null.
175183You can optionally group the values by what is obtained when following the
176- path specified in ` $groupPath ` . :
184+ path specified in ` $groupPath ` :
177185
178186``` php
179187$a = [
@@ -312,6 +320,8 @@ $result = Hash::combine(
312320*/
313321```
314322
323+ ### Hash::format()
324+
315325` static ` Cake\\ Utility\\ Hash::** format** (array $data, array $paths, $format)
316326
317327Returns a series of values extracted from an array, formatted with a
@@ -367,6 +377,8 @@ $res = Hash::format($data, ['{n}.Person.first_name', '{n}.Person.something'], '%
367377*/
368378```
369379
380+ ### Hash::contains()
381+
370382` static ` Cake\\ Utility\\ Hash::** contains** (array $data, array $needle)
371383
372384Determines if one Hash or array contains the exact keys and values
@@ -392,6 +404,8 @@ $result = Hash::contains($b, $a);
392404// true
393405```
394406
407+ ### Hash::check()
408+
395409` static ` Cake\\ Utility\\ Hash::** check** (array $data, string $path = null)
396410
397411Checks if a particular path is set in an array:
@@ -430,6 +444,8 @@ $result = Hash::check($set, 'My Index 1.First.Seconds.Third.Fourth');
430444// $result == false
431445```
432446
447+ ### Hash::filter()
448+
433449` static ` Cake\\ Utility\\ Hash::** filter** (array $data, $callback = [ 'Hash', 'filter'] )
434450
435451Filters empty elements out of array, excluding '0'. You can also supply a
@@ -460,6 +476,8 @@ $res = Hash::filter($data);
460476*/
461477```
462478
479+ ### Hash::flatten()
480+
463481` static ` Cake\\ Utility\\ Hash::** flatten** (array $data, string $separator = '.')
464482
465483Collapses a multi-dimensional array into a single dimension:
@@ -490,6 +508,8 @@ $res = Hash::flatten($arr);
490508*/
491509```
492510
511+ ### Hash::expand()
512+
493513` static ` Cake\\ Utility\\ Hash::** expand** (array $data, string $separator = '.')
494514
495515Expands an array that was previously flattened with
@@ -521,6 +541,8 @@ $res = Hash::expand($data);
521541*/
522542```
523543
544+ ### Hash::merge()
545+
524546` static ` Cake\\ Utility\\ Hash::** merge** (array $data, array $merge[ , array $n] )
525547
526548This function can be thought of as a hybrid between PHP's
@@ -572,6 +594,8 @@ $res = Hash::merge($array, $arrayB, $arrayC, $arrayD);
572594*/
573595```
574596
597+ ### Hash::numeric()
598+
575599` static ` Cake\\ Utility\\ Hash::** numeric** (array $data)
576600
577601Checks to see if all the values in the array are numeric:
@@ -586,7 +610,9 @@ $res = Hash::numeric($data);
586610// $res is false
587611```
588612
589- ` static ` Cake\\ Utility\\ Hash::** dimensions ** (array $data)
613+ ### Hash::dimensions()
614+
615+ ` static ` Cake\\ Utility\\ Hash::** dimensions** (array $data)
590616
591617Counts the dimensions of an array. This method will only
592618consider the dimension of the first element in the array:
@@ -613,6 +639,8 @@ $result = Hash::dimensions($data);
613639// $result == 2
614640```
615641
642+ ### Hash::maxDimensions()
643+
616644` static ` Cake\\ Utility\\ Hash::** maxDimensions** (array $data)
617645
618646Similar to ` ~Hash::dimensions() ` , however this method returns,
@@ -628,6 +656,8 @@ $result = Hash::maxDimensions($data);
628656// $result == 3
629657```
630658
659+ ### Hash::map()
660+
631661` static ` Cake\\ Utility\\ Hash::** map** (array $data, $path, $function)
632662
633663Creates a new array, by extracting ` $path ` , and mapping ` $function `
@@ -645,12 +675,16 @@ public function noop(array $array)
645675}
646676```
647677
678+ ### Hash::reduce()
679+
648680` static ` Cake\\ Utility\\ Hash::** reduce** (array $data, $path, $function)
649681
650682Creates a single value, by extracting ` $path ` , and reducing the extracted
651683results with ` $function ` . You can use both expression and matching elements
652684with this method.
653685
686+ ### Hash::apply()
687+
654688` static ` Cake\\ Utility\\ Hash::** apply** (array $data, $path, $function)
655689
656690Apply a callback to a set of extracted values using ` $function ` . The function
@@ -671,6 +705,8 @@ $result = Hash::apply($data, '{n}[booked=true].date', 'array_count_values');
671705*/
672706```
673707
708+ ### Hash::sort()
709+
674710` static ` Cake\\ Utility\\ Hash::** sort** (array $data, $path, $dir, $type = 'regular')
675711
676712Sorts an array by any value, determined by a [ Hash Path Syntax] ( #hash-path-syntax )
@@ -707,6 +743,8 @@ can be one of the following values:
707743- ` natural ` for sorting values in a human friendly way. Will
708744 sort ` foo10 ` below ` foo2 ` as an example.
709745
746+ ### Hash::diff()
747+
710748` static ` Cake\\ Utility\\ Hash::** diff** (array $data, array $compare)
711749
712750Computes the difference between two arrays:
@@ -732,6 +770,8 @@ $result = Hash::diff($a, $b);
732770*/
733771```
734772
773+ ### Hash::mergeDiff()
774+
735775` static ` Cake\\ Utility\\ Hash::** mergeDiff** (array $data, array $compare)
736776
737777This function merges two arrays and pushes the differences in
@@ -778,6 +818,8 @@ $res = Hash::mergeDiff($array1, $array2);
778818*/
779819```
780820
821+ ### Hash::normalize()
822+
781823` static ` Cake\\ Utility\\ Hash::** normalize** (array $data, $assoc = true, $default = null)
782824
783825Normalizes an array. If ` $assoc ` is ` true ` , the resulting array will be
@@ -833,6 +875,8 @@ $result = Hash::normalize($b);
833875The ` $default ` parameter was added.
834876:::
835877
878+ ### Hash::nest()
879+
836880` static ` Cake\\ Utility\\ Hash::** nest** (array $data, array $options = [ ] )
837881
838882Takes a flat array set, and creates a nested, or threaded data structure.
0 commit comments