Skip to content

Commit

Permalink
Docblock update
Browse files Browse the repository at this point in the history
  • Loading branch information
chinpei215 committed Oct 6, 2017
1 parent b3d83af commit ccf634e
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions lib/Cake/Utility/Hash.php
Expand Up @@ -91,8 +91,8 @@ public static function get(array $data, $path, $default = null) {
*
* - `1.User.name` Get the name of the user at index 1.
* - `{n}.User.name` Get the name of every user in the set of users.
* - `{n}.User[id]` Get the name of every user with an id key.
* - `{n}.User[id>=2]` Get the name of every user with an id key greater than or equal to 2.
* - `{n}.User[id].name` Get the name of every user with an id key.
* - `{n}.User[id>=2].name` Get the name of every user with an id key greater than or equal to 2.
* - `{n}.User[username=/^paul/]` Get User elements with username matching `^paul`.
*
* @param array $data The data to extract from.
Expand Down Expand Up @@ -149,6 +149,7 @@ public static function extract(array $data, $path) {
}
return $context[$_key];
}

/**
* Split token conditions
*
Expand Down Expand Up @@ -454,7 +455,7 @@ public static function combine(array $data, $keyPath, $valuePath = null, $groupP
* The `$format` string can use any format options that `vsprintf()` and `sprintf()` do.
*
* @param array $data Source array from which to extract the data
* @param string $paths An array containing one or more Hash::extract()-style key paths
* @param array $paths An array containing one or more Hash::extract()-style key paths
* @param string $format Format string into which values will be inserted, see sprintf()
* @return array An array of strings extracted from `$path` and formatted with `$format`
* @link https://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::format
Expand Down Expand Up @@ -729,7 +730,7 @@ public static function numeric(array $data) {
* Counts the dimensions of an array.
* Only considers the dimension of the first element in the array.
*
* If you have an un-even or heterogenous array, consider using Hash::maxDimensions()
* If you have an un-even or heterogeneous array, consider using Hash::maxDimensions()
* to get the dimensions of the array.
*
* @param array $data Array to count dimensions on
Expand Down Expand Up @@ -809,11 +810,15 @@ public static function reduce(array $data, $path, $function) {
* You can easily count the results of an extract using apply().
* For example to count the comments on an Article:
*
* `$count = Hash::apply($data, 'Article.Comment.{n}', 'count');`
* ```
* $count = Hash::apply($data, 'Article.Comment.{n}', 'count');
* ```
*
* You could also use a function like `array_sum` to sum the results.
*
* `$total = Hash::apply($data, '{n}.Item.price', 'array_sum');`
* ```
* $total = Hash::apply($data, '{n}.Item.price', 'array_sum');
* ```
*
* @param array $data The data to reduce.
* @param string $path The path to extract from $data.
Expand All @@ -833,7 +838,7 @@ public static function apply(array $data, $path, $function) {
* - `asc` Sort ascending.
* - `desc` Sort descending.
*
* ## Sort types
* ### Sort types
*
* - `regular` For regular sorting (don't change types)
* - `numeric` Compare values numerically
Expand Down

0 comments on commit ccf634e

Please sign in to comment.