|
|
@@ -43,7 +43,7 @@ class Hash
|
|
|
* @param mixed $default The return value when the path does not exist
|
|
|
* @throws \InvalidArgumentException
|
|
|
* @return mixed The value fetched from the array, or null.
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::get
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::get
|
|
|
*/
|
|
|
public static function get($data, $path, $default = null)
|
|
|
{
|
|
|
@@ -118,7 +118,7 @@ class Hash
|
|
|
* @param string $path The path to extract.
|
|
|
* @return array An array of the extracted values. Returns an empty array
|
|
|
* if there are no matches.
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::extract
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::extract
|
|
|
*/
|
|
|
public static function extract($data, $path)
|
|
|
{
|
|
|
@@ -289,7 +289,7 @@ class Hash
|
|
|
* @param string $path The path to insert at.
|
|
|
* @param array|null $values The values to insert.
|
|
|
* @return array The data with $values inserted.
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::insert
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::insert
|
|
|
*/
|
|
|
public static function insert(array $data, $path, $values = null)
|
|
|
{
|
|
|
@@ -380,7 +380,7 @@ class Hash
|
|
|
* @param array $data The data to operate on
|
|
|
* @param string $path A path expression to use to remove.
|
|
|
* @return array The modified array.
|
|
|
- * @link http://book.cakephp.org/3.0/en/core--libraries/hash.html#Hash::remove
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::remove
|
|
|
*/
|
|
|
public static function remove(array $data, $path)
|
|
|
{
|
|
|
@@ -438,7 +438,7 @@ class Hash
|
|
|
* @param string|null $valuePath A dot-separated string.
|
|
|
* @param string|null $groupPath A dot-separated string.
|
|
|
* @return array Combined array
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::combine
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::combine
|
|
|
* @throws \RuntimeException When keys and values count is unequal.
|
|
|
*/
|
|
|
public static function combine(array $data, $keyPath, $valuePath = null, $groupPath = null)
|
|
|
@@ -511,7 +511,7 @@ class Hash
|
|
|
* @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|null An array of strings extracted from `$path` and formatted with `$format`
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::format
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::format
|
|
|
* @see sprintf()
|
|
|
* @see Hash::extract()
|
|
|
*/
|
|
|
@@ -550,7 +550,7 @@ class Hash
|
|
|
* @param array $data The data to search through.
|
|
|
* @param array $needle The values to file in $data
|
|
|
* @return bool true If $data contains $needle, false otherwise
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::contains
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::contains
|
|
|
*/
|
|
|
public static function contains(array $data, array $needle)
|
|
|
{
|
|
|
@@ -593,7 +593,7 @@ class Hash
|
|
|
* @param string $path The path to check for.
|
|
|
* @return bool Existence of path.
|
|
|
* @see Hash::extract()
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::check
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::check
|
|
|
*/
|
|
|
public static function check(array $data, $path)
|
|
|
{
|
|
|
@@ -611,7 +611,7 @@ class Hash
|
|
|
* @param callable $callback A function to filter the data with. Defaults to
|
|
|
* `static::_filter()` Which strips out all non-zero empty values.
|
|
|
* @return array Filtered array
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::filter
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::filter
|
|
|
*/
|
|
|
public static function filter(array $data, $callback = ['self', '_filter'])
|
|
|
{
|
|
|
@@ -642,7 +642,7 @@ class Hash
|
|
|
* @param array $data Array to flatten
|
|
|
* @param string $separator String used to separate array key elements in a path, defaults to '.'
|
|
|
* @return array
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::flatten
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::flatten
|
|
|
*/
|
|
|
public static function flatten(array $data, $separator = '.')
|
|
|
{
|
|
|
@@ -685,7 +685,7 @@ class Hash
|
|
|
* @param array $data Flattened array
|
|
|
* @param string $separator The delimiter used
|
|
|
* @return array
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::expand
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::expand
|
|
|
*/
|
|
|
public static function expand(array $data, $separator = '.')
|
|
|
{
|
|
|
@@ -721,7 +721,7 @@ class Hash
|
|
|
* @param array $data Array to be merged
|
|
|
* @param mixed $merge Array to merge with. The argument and all trailing arguments will be array cast when merged
|
|
|
* @return array Merged array
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::merge
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::merge
|
|
|
*/
|
|
|
public static function merge(array $data, $merge)
|
|
|
{
|
|
|
@@ -767,7 +767,7 @@ class Hash
|
|
|
*
|
|
|
* @param array $data The array to check.
|
|
|
* @return bool true if values are numeric, false otherwise
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::numeric
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::numeric
|
|
|
*/
|
|
|
public static function numeric(array $data)
|
|
|
{
|
|
|
@@ -786,7 +786,7 @@ class Hash
|
|
|
*
|
|
|
* @param array $data Array to count dimensions on
|
|
|
* @return int The number of dimensions in $data
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::dimensions
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::dimensions
|
|
|
*/
|
|
|
public static function dimensions(array $data)
|
|
|
{
|
|
|
@@ -812,7 +812,7 @@ class Hash
|
|
|
*
|
|
|
* @param array $data Array to count dimensions on
|
|
|
* @return int The maximum number of dimensions in $data
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::maxDimensions
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::maxDimensions
|
|
|
*/
|
|
|
public static function maxDimensions(array $data)
|
|
|
{
|
|
|
@@ -837,7 +837,7 @@ class Hash
|
|
|
* @param string $path The path to extract for mapping over.
|
|
|
* @param callable $function The function to call on each extracted value.
|
|
|
* @return array An array of the modified values.
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::map
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::map
|
|
|
*/
|
|
|
public static function map(array $data, $path, $function)
|
|
|
{
|
|
|
@@ -852,7 +852,7 @@ class Hash
|
|
|
* @param string $path The path to extract from $data.
|
|
|
* @param callable $function The function to call on each extracted value.
|
|
|
* @return mixed The reduced value.
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::reduce
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::reduce
|
|
|
*/
|
|
|
public static function reduce(array $data, $path, $function)
|
|
|
{
|
|
|
@@ -883,6 +883,7 @@ class Hash
|
|
|
* @param string $path The path to extract from $data.
|
|
|
* @param callable $function The function to call on each extracted value.
|
|
|
* @return mixed The results of the applied method.
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::apply
|
|
|
*/
|
|
|
public static function apply(array $data, $path, $function)
|
|
|
{
|
|
|
@@ -920,7 +921,7 @@ class Hash
|
|
|
* @param string $dir See directions above. Defaults to 'asc'.
|
|
|
* @param array|string $type See direction types above. Defaults to 'regular'.
|
|
|
* @return array Sorted array of data
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::sort
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::sort
|
|
|
*/
|
|
|
public static function sort(array $data, $path, $dir = 'asc', $type = 'regular')
|
|
|
{
|
|
|
@@ -1031,7 +1032,7 @@ class Hash
|
|
|
* @param array $compare Second value
|
|
|
* @return array Returns the key => value pairs that are not common in $data and $compare
|
|
|
* The expression for this function is ($data - $compare) + ($compare - ($data - $compare))
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::diff
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::diff
|
|
|
*/
|
|
|
public static function diff(array $data, array $compare)
|
|
|
{
|
|
|
@@ -1058,7 +1059,7 @@ class Hash
|
|
|
* @param array $data The data to append onto.
|
|
|
* @param array $compare The data to compare and append onto.
|
|
|
* @return array The merged array.
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::mergeDiff
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::mergeDiff
|
|
|
*/
|
|
|
public static function mergeDiff(array $data, array $compare)
|
|
|
{
|
|
|
@@ -1084,7 +1085,7 @@ class Hash
|
|
|
* @param array $data List to normalize
|
|
|
* @param bool $assoc If true, $data will be converted to an associative array.
|
|
|
* @return array
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::normalize
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::normalize
|
|
|
*/
|
|
|
public static function normalize(array $data, $assoc = true)
|
|
|
{
|
|
|
@@ -1131,7 +1132,7 @@ class Hash
|
|
|
* @return array of results, nested
|
|
|
* @see Hash::extract()
|
|
|
* @throws \InvalidArgumentException When providing invalid data.
|
|
|
- * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Hash::nest
|
|
|
+ * @link http://book.cakephp.org/3.0/en/core-libraries/hash.html#Cake\Utility\Hash::nest
|
|
|
*/
|
|
|
public static function nest(array $data, array $options = [])
|
|
|
{
|