Updating docs for Set library. Deprecating Set::isEqual().

This commit is contained in:
jperras 2009-09-25 15:05:06 -04:00
parent f231b59cfb
commit 03b1089f1d
2 changed files with 11 additions and 30 deletions

View file

@ -820,14 +820,17 @@ class Set extends Object {
/** /**
* Determines if two Sets or arrays are equal * Determines if two Sets or arrays are equal
* This method is deprecated, and will be removed in a future release.
* *
* @param array $val1 First value * @param array $val1 First value
* @param array $val2 Second value * @param array $val2 Second value
* @return boolean true if they are equal, false otherwise * @return boolean true if they are equal, false otherwise
* @access public * @access public
* @static * @static
* @deprecated
*/ */
function isEqual($val1, $val2 = null) { function isEqual($val1, $val2 = null) {
trigger_error('Set::isEqual() is deprecated. Please use standard comparison operators instead.', E_USER_WARNING);
return ($val1 == $val2); return ($val1 == $val2);
} }
@ -1002,11 +1005,10 @@ class Set extends Object {
} }
/** /**
* Converts an object into an array. If $object is no object, reverse * Converts an object into an array.
* will return the same value.
*
* @param object $object Object to reverse * @param object $object Object to reverse
* @return array * @return array Array representation of given object
* @public
* @static * @static
*/ */
function reverse($object) { function reverse($object) {
@ -1110,10 +1112,10 @@ class Set extends Object {
/** /**
* Sorts an array by any value, determined by a Set-compatible path * Sorts an array by any value, determined by a Set-compatible path
* *
* @param array $data * @param array $data An array of data to sort
* @param string $path A Set-compatible path to the array value * @param string $path A Set-compatible path to the array value
* @param string $dir asc/desc * @param string $dir Direction of sorting - either ascending (ASC), or descending (DESC)
* @return array * @return array Sorted array of data
* @static * @static
*/ */
function sort($data, $path, $dir) { function sort($data, $path, $dir) {
@ -1151,6 +1153,8 @@ class Set extends Object {
* to array_map, reduce will handoff to array_reduce, and pass will * to array_map, reduce will handoff to array_reduce, and pass will
* use call_user_func_array(). * use call_user_func_array().
* @return mixed Result of the callback when applied to extracted data * @return mixed Result of the callback when applied to extracted data
* @access public
* @static
*/ */
function apply($path, $data, $callback, $options = array()) { function apply($path, $data, $callback, $options = array()) {
$defaults = array('type' => 'pass'); $defaults = array('type' => 'pass');

View file

@ -1450,29 +1450,6 @@ class SetTest extends CakeTestCase {
$this->assertIdentical($result, $expected); $this->assertIdentical($result, $expected);
} }
/**
* testIsEqual method
*
* @access public
* @return void
*/
function testIsEqual() {
$a = array(
0 => array('name' => 'main'),
1 => array('name' => 'about')
);
$b = array(
0 => array('name' => 'main'),
1 => array('name' => 'about'),
2 => array('name' => 'contact')
);
$this->assertTrue(Set::isEqual($a, $a));
$this->assertTrue(Set::isEqual($b, $b));
$this->assertFalse(Set::isEqual($a, $b));
$this->assertFalse(Set::isEqual($b, $a));
}
/** /**
* testContains method * testContains method
* *