Added @link to all public functions there have documentation.

And correct a small 'typo'.
This commit is contained in:
Kim Egede Jakobsen 2013-08-31 17:12:29 -07:00
parent dbbd05d850
commit 46d3d8e48e

View file

@ -38,6 +38,7 @@ class Hash {
* @param string|array $path The path being searched for. Either a dot * @param string|array $path The path being searched for. Either a dot
* separated string, or an array of path segments. * separated string, or an array of path segments.
* @return mixed The value fetched from the array, or null. * @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) { public static function get(array $data, $path) {
if (empty($data)) { if (empty($data)) {
@ -85,6 +86,7 @@ class Hash {
* @param string $path The path to extract. * @param string $path The path to extract.
* @return array An array of the extracted values. Returns an empty array * @return array An array of the extracted values. Returns an empty array
* if there are no matches. * 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) { public static function extract(array $data, $path) {
if (empty($path)) { if (empty($path)) {
@ -220,6 +222,7 @@ class Hash {
* @param string $path The path to insert at. * @param string $path The path to insert at.
* @param array $values The values to insert. * @param array $values The values to insert.
* @return array The data with $values inserted. * @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) { public static function insert(array $data, $path, $values = null) {
$tokens = explode('.', $path); $tokens = explode('.', $path);
@ -288,6 +291,7 @@ class Hash {
* @param array $data The data to operate on * @param array $data The data to operate on
* @param string $path A path expression to use to remove. * @param string $path A path expression to use to remove.
* @return array The modified array. * @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) { public static function remove(array $data, $path) {
$tokens = explode('.', $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 * @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::format
* @see sprintf() * @see sprintf()
* @see Hash::extract() * @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) { public static function format(array $data, array $paths, $format) {
$extracted = array(); $extracted = array();
@ -466,6 +471,7 @@ class Hash {
* @param string $path The path to check for. * @param string $path The path to check for.
* @return boolean Existence of path. * @return boolean Existence of path.
* @see Hash::extract() * @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) { public static function check(array $data, $path) {
$results = self::extract($data, $path); $results = self::extract($data, $path);
@ -556,6 +562,7 @@ class Hash {
* @param array $data Flattened array * @param array $data Flattened array
* @param string $separator The delimiter used * @param string $separator The delimiter used
* @return array * @return array
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::expand
*/ */
public static function expand($data, $separator = '.') { public static function expand($data, $separator = '.') {
$result = array(); $result = array();
@ -678,6 +685,7 @@ class Hash {
* @param string $path The path to extract for mapping over. * @param string $path The path to extract for mapping over.
* @param callable $function The function to call on each extracted value. * @param callable $function The function to call on each extracted value.
* @return array An array of the modified values. * @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) { public static function map(array $data, $path, $function) {
$values = (array)self::extract($data, $path); $values = (array)self::extract($data, $path);
@ -691,6 +699,7 @@ class Hash {
* @param string $path The path to extract from $data. * @param string $path The path to extract from $data.
* @param callable $function The function to call on each extracted value. * @param callable $function The function to call on each extracted value.
* @return mixed The reduced 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) { public static function reduce(array $data, $path, $function) {
$values = (array)self::extract($data, $path); $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 $data The data to append onto.
* @param array $compare The data to compare and append onto. * @param array $compare The data to compare and append onto.
* @return array The merged array. * @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) { public static function mergeDiff(array $data, $compare) {
if (empty($data) && !empty($compare)) { if (empty($data) && !empty($compare)) {
@ -932,6 +942,7 @@ class Hash {
* @param array $options Options are: * @param array $options Options are:
* @return array of results, nested * @return array of results, nested
* @see Hash::extract() * @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()) { public static function nest(array $data, $options = array()) {
if (!$data) { if (!$data) {