Skip to content
Permalink
Browse files

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

  • Loading branch information...
jperras committed Sep 25, 2009
1 parent f231b59 commit 03b1089f1d1a63f3c343a9f47da7be545573901e
Showing with 11 additions and 30 deletions.
  1. +11 −7 cake/libs/set.php
  2. +0 −23 cake/tests/cases/libs/set.test.php
@@ -820,14 +820,17 @@ function diff($val1, $val2 = null) {
/**
* 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 $val2 Second value
* @return boolean true if they are equal, false otherwise
* @access public
* @static
* @deprecated
*/
function isEqual($val1, $val2 = null) {
trigger_error('Set::isEqual() is deprecated. Please use standard comparison operators instead.', E_USER_WARNING);
return ($val1 == $val2);
}
@@ -1002,11 +1005,10 @@ function combine($data, $path1 = null, $path2 = null, $groupPath = null) {
}
/**
* Converts an object into an array. If $object is no object, reverse
* will return the same value.
*
* Converts an object into an array.
* @param object $object Object to reverse
* @return array
* @return array Array representation of given object
* @public
* @static
*/
function reverse($object) {
@@ -1110,10 +1112,10 @@ function __flatten($results, $key = null) {
/**
* 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 $dir asc/desc
* @return array
* @param string $dir Direction of sorting - either ascending (ASC), or descending (DESC)
* @return array Sorted array of data
* @static
*/
function sort($data, $path, $dir) {
@@ -1151,6 +1153,8 @@ function sort($data, $path, $dir) {
* to array_map, reduce will handoff to array_reduce, and pass will
* use call_user_func_array().
* @return mixed Result of the callback when applied to extracted data
* @access public
* @static
*/
function apply($path, $data, $callback, $options = array()) {
$defaults = array('type' => 'pass');
@@ -1450,29 +1450,6 @@ function testDiff() {
$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
*

0 comments on commit 03b1089

Please sign in to comment.
You can’t perform that action at this time.