Skip to content

Commit 03b1089

Browse files
committed
Updating docs for Set library. Deprecating Set::isEqual().
1 parent f231b59 commit 03b1089

File tree

2 files changed

+11
-30
lines changed

2 files changed

+11
-30
lines changed

cake/libs/set.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -820,14 +820,17 @@ function diff($val1, $val2 = null) {
820820

821821
/**
822822
* Determines if two Sets or arrays are equal
823+
* This method is deprecated, and will be removed in a future release.
823824
*
824825
* @param array $val1 First value
825826
* @param array $val2 Second value
826827
* @return boolean true if they are equal, false otherwise
827828
* @access public
828829
* @static
830+
* @deprecated
829831
*/
830832
function isEqual($val1, $val2 = null) {
833+
trigger_error('Set::isEqual() is deprecated. Please use standard comparison operators instead.', E_USER_WARNING);
831834
return ($val1 == $val2);
832835
}
833836

@@ -1002,11 +1005,10 @@ function combine($data, $path1 = null, $path2 = null, $groupPath = null) {
10021005
}
10031006

10041007
/**
1005-
* Converts an object into an array. If $object is no object, reverse
1006-
* will return the same value.
1007-
*
1008+
* Converts an object into an array.
10081009
* @param object $object Object to reverse
1009-
* @return array
1010+
* @return array Array representation of given object
1011+
* @public
10101012
* @static
10111013
*/
10121014
function reverse($object) {
@@ -1110,10 +1112,10 @@ function __flatten($results, $key = null) {
11101112
/**
11111113
* Sorts an array by any value, determined by a Set-compatible path
11121114
*
1113-
* @param array $data
1115+
* @param array $data An array of data to sort
11141116
* @param string $path A Set-compatible path to the array value
1115-
* @param string $dir asc/desc
1116-
* @return array
1117+
* @param string $dir Direction of sorting - either ascending (ASC), or descending (DESC)
1118+
* @return array Sorted array of data
11171119
* @static
11181120
*/
11191121
function sort($data, $path, $dir) {
@@ -1151,6 +1153,8 @@ function sort($data, $path, $dir) {
11511153
* to array_map, reduce will handoff to array_reduce, and pass will
11521154
* use call_user_func_array().
11531155
* @return mixed Result of the callback when applied to extracted data
1156+
* @access public
1157+
* @static
11541158
*/
11551159
function apply($path, $data, $callback, $options = array()) {
11561160
$defaults = array('type' => 'pass');

cake/tests/cases/libs/set.test.php

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,29 +1450,6 @@ function testDiff() {
14501450
$this->assertIdentical($result, $expected);
14511451
}
14521452

1453-
/**
1454-
* testIsEqual method
1455-
*
1456-
* @access public
1457-
* @return void
1458-
*/
1459-
function testIsEqual() {
1460-
$a = array(
1461-
0 => array('name' => 'main'),
1462-
1 => array('name' => 'about')
1463-
);
1464-
$b = array(
1465-
0 => array('name' => 'main'),
1466-
1 => array('name' => 'about'),
1467-
2 => array('name' => 'contact')
1468-
);
1469-
1470-
$this->assertTrue(Set::isEqual($a, $a));
1471-
$this->assertTrue(Set::isEqual($b, $b));
1472-
$this->assertFalse(Set::isEqual($a, $b));
1473-
$this->assertFalse(Set::isEqual($b, $a));
1474-
}
1475-
14761453
/**
14771454
* testContains method
14781455
*

0 commit comments

Comments
 (0)