Skip to content

Commit

Permalink
Updating docs for Set library. Deprecating Set::isEqual().
Browse files Browse the repository at this point in the history
  • Loading branch information
jperras committed Sep 25, 2009
1 parent f231b59 commit 03b1089
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 30 deletions.
18 changes: 11 additions & 7 deletions cake/libs/set.php
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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');
Expand Down
23 changes: 0 additions & 23 deletions cake/tests/cases/libs/set.test.php
Expand Up @@ -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
*
Expand Down

0 comments on commit 03b1089

Please sign in to comment.