mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Added @link to all public functions there have documentation.
And correct a small 'typo'.
This commit is contained in:
parent
dbbd05d850
commit
46d3d8e48e
1 changed files with 12 additions and 1 deletions
|
@ -38,6 +38,7 @@ class Hash {
|
|||
* @param string|array $path The path being searched for. Either a dot
|
||||
* separated string, or an array of path segments.
|
||||
* @return mixed The value fetched from the array, or null.
|
||||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::get
|
||||
*/
|
||||
public static function get(array $data, $path) {
|
||||
if (empty($data)) {
|
||||
|
@ -85,6 +86,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/2.0/en/core-utility-libraries/hash.html#Hash::extract
|
||||
*/
|
||||
public static function extract(array $data, $path) {
|
||||
if (empty($path)) {
|
||||
|
@ -220,6 +222,7 @@ class Hash {
|
|||
* @param string $path The path to insert at.
|
||||
* @param array $values The values to insert.
|
||||
* @return array The data with $values inserted.
|
||||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::insert
|
||||
*/
|
||||
public static function insert(array $data, $path, $values = null) {
|
||||
$tokens = explode('.', $path);
|
||||
|
@ -288,6 +291,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/2.0/en/core-utility-libraries/hash.html#Hash::remove
|
||||
*/
|
||||
public static function remove(array $data, $path) {
|
||||
$tokens = explode('.', $path);
|
||||
|
@ -389,6 +393,7 @@ class Hash {
|
|||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::format
|
||||
* @see sprintf()
|
||||
* @see Hash::extract()
|
||||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::format
|
||||
*/
|
||||
public static function format(array $data, array $paths, $format) {
|
||||
$extracted = array();
|
||||
|
@ -466,6 +471,7 @@ class Hash {
|
|||
* @param string $path The path to check for.
|
||||
* @return boolean Existence of path.
|
||||
* @see Hash::extract()
|
||||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::check
|
||||
*/
|
||||
public static function check(array $data, $path) {
|
||||
$results = self::extract($data, $path);
|
||||
|
@ -556,6 +562,7 @@ class Hash {
|
|||
* @param array $data Flattened array
|
||||
* @param string $separator The delimiter used
|
||||
* @return array
|
||||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::expand
|
||||
*/
|
||||
public static function expand($data, $separator = '.') {
|
||||
$result = array();
|
||||
|
@ -678,6 +685,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/2.0/en/core-utility-libraries/hash.html#Hash::map
|
||||
*/
|
||||
public static function map(array $data, $path, $function) {
|
||||
$values = (array)self::extract($data, $path);
|
||||
|
@ -691,6 +699,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/2.0/en/core-utility-libraries/hash.html#Hash::reduce
|
||||
*/
|
||||
public static function reduce(array $data, $path, $function) {
|
||||
$values = (array)self::extract($data, $path);
|
||||
|
@ -858,11 +867,12 @@ class Hash {
|
|||
}
|
||||
|
||||
/**
|
||||
* Merges the difference between $data and $push onto $data.
|
||||
* Merges the difference between $data and $compare onto $data.
|
||||
*
|
||||
* @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/2.0/en/core-utility-libraries/hash.html#Hash::mergeDiff
|
||||
*/
|
||||
public static function mergeDiff(array $data, $compare) {
|
||||
if (empty($data) && !empty($compare)) {
|
||||
|
@ -932,6 +942,7 @@ class Hash {
|
|||
* @param array $options Options are:
|
||||
* @return array of results, nested
|
||||
* @see Hash::extract()
|
||||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::nest
|
||||
*/
|
||||
public static function nest(array $data, $options = array()) {
|
||||
if (!$data) {
|
||||
|
|
Loading…
Add table
Reference in a new issue