diff --git a/lib/Cake/Configure/IniReader.php b/lib/Cake/Configure/IniReader.php index 4c8bc7bba..f47713294 100644 --- a/lib/Cake/Configure/IniReader.php +++ b/lib/Cake/Configure/IniReader.php @@ -127,7 +127,7 @@ class IniReader implements ConfigReaderInterface { $value = false; } if (strpos($key, '.') !== false) { - $values = Set::insert($values, $key, $value); + $values = Hash::insert($values, $key, $value); } else { $values[$key] = $value; } diff --git a/lib/Cake/Console/Command/AclShell.php b/lib/Cake/Console/Command/AclShell.php index a935f6b2a..00ae29baf 100644 --- a/lib/Cake/Console/Command/AclShell.php +++ b/lib/Cake/Console/Command/AclShell.php @@ -21,6 +21,7 @@ App::uses('Controller', 'Controller'); App::uses('ComponentCollection', 'Controller'); App::uses('AclComponent', 'Controller/Component'); App::uses('DbAcl', 'Model'); +App::uses('Hash', 'Utility'); /** * Shell for ACL management. This console is known to have issues with zend.ze1_compatibility_mode @@ -558,8 +559,9 @@ class AclShell extends AppShell { $identifier = var_export($identifier, true); } $this->error(__d('cake_console', 'Could not find node using reference "%s"', $identifier)); + return; } - return Set::extract($node, "0.{$class}.id"); + return Hash::get($node, "0.{$class}.id"); } /** diff --git a/lib/Cake/Console/Command/ConsoleShell.php b/lib/Cake/Console/Command/ConsoleShell.php index 2471440c3..ee8f07d39 100644 --- a/lib/Cake/Console/Command/ConsoleShell.php +++ b/lib/Cake/Console/Command/ConsoleShell.php @@ -300,7 +300,7 @@ class ConsoleShell extends AppShell { break; case (preg_match("/^routes\s+show/i", $command, $tmp) == true): $router = Router::getInstance(); - $this->out(implode("\n", Set::extract($router->routes, '{n}.0'))); + $this->out(implode("\n", Hash::extract($router->routes, '{n}.0'))); break; case (preg_match("/^route\s+(\(.*\))$/i", $command, $tmp) == true): if ($url = eval('return array' . $tmp[1] . ';')) { diff --git a/lib/Cake/Console/Command/Task/ExtractTask.php b/lib/Cake/Console/Command/Task/ExtractTask.php index 64aad3b03..24c3e50c6 100644 --- a/lib/Cake/Console/Command/Task/ExtractTask.php +++ b/lib/Cake/Console/Command/Task/ExtractTask.php @@ -19,6 +19,7 @@ App::uses('AppShell', 'Console/Command'); App::uses('File', 'Utility'); App::uses('Folder', 'Utility'); +App::uses('Hash', 'Utility'); /** * Language string extractor @@ -431,7 +432,7 @@ class ExtractTask extends AppShell { return; } - $dims = Set::countDim($rules); + $dims = Hash::dimensions($rules); if ($dims == 1 || ($dims == 2 && isset($rules['message']))) { $rules = array($rules); } diff --git a/lib/Cake/Controller/Component/Acl/DbAcl.php b/lib/Cake/Controller/Component/Acl/DbAcl.php index 14d18319b..37c756bcb 100644 --- a/lib/Cake/Controller/Component/Acl/DbAcl.php +++ b/lib/Cake/Controller/Component/Acl/DbAcl.php @@ -13,6 +13,7 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ App::uses('AclInterface', 'Controller/Component/Acl'); +App::uses('Hash', 'Utility'); /** * DbAcl implements an ACL control system in the database. ARO's and ACO's are diff --git a/lib/Cake/Controller/Component/Acl/IniAcl.php b/lib/Cake/Controller/Component/Acl/IniAcl.php index 8af85ca50..8810668cc 100644 --- a/lib/Cake/Controller/Component/Acl/IniAcl.php +++ b/lib/Cake/Controller/Component/Acl/IniAcl.php @@ -30,7 +30,7 @@ class IniAcl extends Object implements AclInterface { public $config = null; /** - * The Set::classicExtract() path to the user/aro identifier in the + * The Hash::extract() path to the user/aro identifier in the * acl.ini file. This path will be used to extract the string * representation of a user used in the ini file. * @@ -97,7 +97,7 @@ class IniAcl extends Object implements AclInterface { $aclConfig = $this->config; if (is_array($aro)) { - $aro = Set::classicExtract($aro, $this->userPath); + $aro = Hash::get($aro, $this->userPath); } if (isset($aclConfig[$aro]['deny'])) { diff --git a/lib/Cake/Controller/Component/Acl/PhpAcl.php b/lib/Cake/Controller/Component/Acl/PhpAcl.php index d2af2f960..b169c1d70 100644 --- a/lib/Cake/Controller/Component/Acl/PhpAcl.php +++ b/lib/Cake/Controller/Component/Acl/PhpAcl.php @@ -494,7 +494,7 @@ class PhpAro { // detect cycles $roles = $this->roles($dependency); - if (in_array($role, Set::flatten($roles))) { + if (in_array($role, Hash::flatten($roles))) { $path = ''; foreach ($roles as $roleDependencies) { diff --git a/lib/Cake/Controller/Component/Auth/BaseAuthenticate.php b/lib/Cake/Controller/Component/Auth/BaseAuthenticate.php index bcb519b33..560da028f 100644 --- a/lib/Cake/Controller/Component/Auth/BaseAuthenticate.php +++ b/lib/Cake/Controller/Component/Auth/BaseAuthenticate.php @@ -12,8 +12,8 @@ * @link http://cakephp.org CakePHP(tm) Project * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ - App::uses('Security', 'Utility'); +App::uses('Hash', 'Utility'); /** * Base Authentication class with common methods and properties. @@ -58,7 +58,7 @@ abstract class BaseAuthenticate { */ public function __construct(ComponentCollection $collection, $settings) { $this->_Collection = $collection; - $this->settings = Set::merge($this->settings, $settings); + $this->settings = Hash::merge($this->settings, $settings); } /** diff --git a/lib/Cake/Controller/Component/Auth/BaseAuthorize.php b/lib/Cake/Controller/Component/Auth/BaseAuthorize.php index 432886c78..84484587c 100644 --- a/lib/Cake/Controller/Component/Auth/BaseAuthorize.php +++ b/lib/Cake/Controller/Component/Auth/BaseAuthorize.php @@ -12,6 +12,7 @@ * @link http://cakephp.org CakePHP(tm) Project * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ +App::uses('Hash', 'Utility'); /** * Abstract base authorization adapter for AuthComponent. @@ -69,7 +70,7 @@ abstract class BaseAuthorize { $this->_Collection = $collection; $controller = $collection->getController(); $this->controller($controller); - $this->settings = Set::merge($this->settings, $settings); + $this->settings = Hash::merge($this->settings, $settings); } /** diff --git a/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php index 24a812f69..80bc25027 100644 --- a/lib/Cake/Controller/Component/AuthComponent.php +++ b/lib/Cake/Controller/Component/AuthComponent.php @@ -19,11 +19,11 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ - App::uses('Component', 'Controller'); App::uses('Router', 'Routing'); App::uses('Security', 'Utility'); App::uses('Debugger', 'Utility'); +App::uses('Hash', 'Utility'); App::uses('CakeSession', 'Model/Datasource'); App::uses('BaseAuthorize', 'Controller/Component/Auth'); App::uses('BaseAuthenticate', 'Controller/Component/Auth'); @@ -394,7 +394,7 @@ class AuthComponent extends Component { return; } $this->_authorizeObjects = array(); - $config = Set::normalize($this->authorize); + $config = Hash::normalize((array)$this->authorize); $global = array(); if (isset($config[AuthComponent::ALL])) { $global = $config[AuthComponent::ALL]; @@ -652,7 +652,7 @@ class AuthComponent extends Component { return; } $this->_authenticateObjects = array(); - $config = Set::normalize($this->authenticate); + $config = Hash::normalize((array)$this->authenticate); $global = array(); if (isset($config[AuthComponent::ALL])) { $global = $config[AuthComponent::ALL]; diff --git a/lib/Cake/Controller/Component/CookieComponent.php b/lib/Cake/Controller/Component/CookieComponent.php index 31d2778f6..90d2587a3 100644 --- a/lib/Cake/Controller/Component/CookieComponent.php +++ b/lib/Cake/Controller/Component/CookieComponent.php @@ -19,6 +19,7 @@ App::uses('Component', 'Controller'); App::uses('Security', 'Utility'); +App::uses('Hash', 'Utility'); /** * Cookie Component. @@ -239,7 +240,7 @@ class CookieComponent extends Component { if (!isset($this->_values[$this->name][$names[0]])) { $this->_values[$this->name][$names[0]] = array(); } - $this->_values[$this->name][$names[0]] = Set::insert($this->_values[$this->name][$names[0]], $names[1], $value); + $this->_values[$this->name][$names[0]] = Hash::insert($this->_values[$this->name][$names[0]], $names[1], $value); $this->_write('[' . implode('][', $names) . ']', $value); } } @@ -276,7 +277,7 @@ class CookieComponent extends Component { } if (!empty($names[1])) { - return Set::extract($this->_values[$this->name][$key], $names[1]); + return Hash::get($this->_values[$this->name][$key], $names[1]); } return $this->_values[$this->name][$key]; } @@ -310,7 +311,7 @@ class CookieComponent extends Component { } $names = explode('.', $key, 2); if (isset($this->_values[$this->name][$names[0]])) { - $this->_values[$this->name][$names[0]] = Set::remove($this->_values[$this->name][$names[0]], $names[1]); + $this->_values[$this->name][$names[0]] = Hash::remove($this->_values[$this->name][$names[0]], $names[1]); } $this->_delete('[' . implode('][', $names) . ']'); } diff --git a/lib/Cake/Controller/Component/PaginatorComponent.php b/lib/Cake/Controller/Component/PaginatorComponent.php index 9758e66eb..a99523332 100644 --- a/lib/Cake/Controller/Component/PaginatorComponent.php +++ b/lib/Cake/Controller/Component/PaginatorComponent.php @@ -16,6 +16,7 @@ * @since CakePHP(tm) v 2.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ +App::uses('Hash', 'Utility'); /** * This component is used to handle automatic model data pagination. The primary way to use this @@ -194,7 +195,7 @@ class PaginatorComponent extends Component { 'pageCount' => $pageCount, 'order' => $order, 'limit' => $limit, - 'options' => Set::diff($options, $defaults), + 'options' => Hash::diff($options, $defaults), 'paramType' => $options['paramType'] ); if (!isset($this->Controller->request['paging'])) { diff --git a/lib/Cake/Controller/Component/SecurityComponent.php b/lib/Cake/Controller/Component/SecurityComponent.php index 1617c46a1..1a2043895 100644 --- a/lib/Cake/Controller/Component/SecurityComponent.php +++ b/lib/Cake/Controller/Component/SecurityComponent.php @@ -19,6 +19,7 @@ App::uses('Component', 'Controller'); App::uses('String', 'Utility'); +App::uses('Hash', 'Utility'); App::uses('Security', 'Utility'); /** @@ -443,7 +444,7 @@ class SecurityComponent extends Component { $unlocked = explode('|', $unlocked); $lockedFields = array(); - $fields = Set::flatten($check); + $fields = Hash::flatten($check); $fieldList = array_keys($fields); $multi = array(); diff --git a/lib/Cake/Core/Object.php b/lib/Cake/Core/Object.php index 34ea4fbe1..d523097c1 100644 --- a/lib/Cake/Core/Object.php +++ b/lib/Cake/Core/Object.php @@ -181,7 +181,7 @@ class Object { * * @param array $properties The name of the properties to merge. * @param string $class The class to merge the property with. - * @param boolean $normalize Set to true to run the properties through Set::normalize() before merging. + * @param boolean $normalize Set to true to run the properties through Hash::normalize() before merging. * @return void */ protected function _mergeVars($properties, $class, $normalize = true) { @@ -194,10 +194,10 @@ class Object { $this->{$var} != $classProperties[$var] ) { if ($normalize) { - $classProperties[$var] = Set::normalize($classProperties[$var]); - $this->{$var} = Set::normalize($this->{$var}); + $classProperties[$var] = Hash::normalize($classProperties[$var]); + $this->{$var} = Hash::normalize($this->{$var}); } - $this->{$var} = Set::merge($classProperties[$var], $this->{$var}); + $this->{$var} = Hash::merge($classProperties[$var], $this->{$var}); } } } diff --git a/lib/Cake/Model/Behavior/AclBehavior.php b/lib/Cake/Model/Behavior/AclBehavior.php index 0998784ed..0f78a27d1 100644 --- a/lib/Cake/Model/Behavior/AclBehavior.php +++ b/lib/Cake/Model/Behavior/AclBehavior.php @@ -19,6 +19,7 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ App::uses('AclNode', 'Model'); +App::uses('Hash', 'Utility'); /** * ACL behavior @@ -131,7 +132,7 @@ class AclBehavior extends ModelBehavior { $types = array($types); } foreach ($types as $type) { - $node = Set::extract($this->node($model, null, $type), "0.{$type}.id"); + $node = Hash::extract($this->node($model, null, $type), "0.{$type}.id"); if (!empty($node)) { $model->{$type}->delete($node); } diff --git a/lib/Cake/Model/Behavior/ContainableBehavior.php b/lib/Cake/Model/Behavior/ContainableBehavior.php index e5929f29a..bb7c25549 100644 --- a/lib/Cake/Model/Behavior/ContainableBehavior.php +++ b/lib/Cake/Model/Behavior/ContainableBehavior.php @@ -321,7 +321,7 @@ class ContainableBehavior extends ModelBehavior { $key = $option; $optionKey = true; if (!empty($newChildren)) { - $children = Set::merge($children, $newChildren); + $children = Hash::merge($children, $newChildren); } } if ($optionKey && isset($children[$key])) { diff --git a/lib/Cake/Model/Behavior/TreeBehavior.php b/lib/Cake/Model/Behavior/TreeBehavior.php index 03a8f2662..cc1c788cc 100644 --- a/lib/Cake/Model/Behavior/TreeBehavior.php +++ b/lib/Cake/Model/Behavior/TreeBehavior.php @@ -363,10 +363,10 @@ class TreeBehavior extends ModelBehavior { } if ($valuePath == null) { - $valuePath = array('{0}{1}', '{n}.tree_prefix', '{n}.' . $Model->alias . '.' . $Model->displayField); + $valuePath = array('%s%s', '{n}.tree_prefix', '{n}.' . $Model->alias . '.' . $Model->displayField); } elseif (is_string($valuePath)) { - $valuePath = array('{0}{1}', '{n}.tree_prefix', $valuePath); + $valuePath = array('%s%s', '{n}.tree_prefix', $valuePath); } else { $valuePath[0] = '{' . (count($valuePath) - 1) . '}' . $valuePath[0]; @@ -386,7 +386,7 @@ class TreeBehavior extends ModelBehavior { if (empty($results)) { return array(); } - return Set::combine($results, $keyPath, $valuePath); + return Hash::combine($results, $keyPath, $valuePath); } /** diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index 2c15b9cbe..99d3267fa 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -245,7 +245,7 @@ class CakeSession { */ public static function delete($name) { if (self::check($name)) { - self::_overwrite($_SESSION, Set::remove($_SESSION, $name)); + self::_overwrite($_SESSION, Hash::remove($_SESSION, $name)); return (self::check($name) == false); } self::_setError(2, __d('cake_dev', "%s doesn't exist", $name)); @@ -452,7 +452,7 @@ class CakeSession { if (isset($sessionConfig['defaults'])) { $defaults = self::_defaultConfig($sessionConfig['defaults']); if ($defaults) { - $sessionConfig = Set::merge($defaults, $sessionConfig); + $sessionConfig = Hash::merge($defaults, $sessionConfig); } } if (!isset($sessionConfig['ini']['session.cookie_secure']) && env('HTTPS')) { diff --git a/lib/Cake/Model/Datasource/Database/Postgres.php b/lib/Cake/Model/Datasource/Database/Postgres.php index 41d1844d0..064a1cca4 100644 --- a/lib/Cake/Model/Datasource/Database/Postgres.php +++ b/lib/Cake/Model/Datasource/Database/Postgres.php @@ -421,7 +421,7 @@ class Postgres extends DboSource { $match[1] = $this->name($match[1]); } elseif (!$constant) { $parts = explode('.', $match[1]); - if (!Set::numeric($parts)) { + if (!Hash::numeric($parts)) { $match[1] = $this->name($match[1]); } } diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index ec96f8fb0..8c24ed637 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -1409,7 +1409,7 @@ class DboSource extends DataSource { if ($mergeKeys[0] === $dataKeys[0] || $mergeKeys === $dataKeys) { $data[$association][$association] = $merge[0][$association]; } else { - $diff = Set::diff($dataAssocTmp, $mergeAssocTmp); + $diff = Hash::diff($dataAssocTmp, $mergeAssocTmp); $data[$association] = array_merge($merge[0][$association], $diff); } } elseif ($selfJoin && array_key_exists($association, $merge[0])) { @@ -1934,7 +1934,7 @@ class DboSource extends DataSource { return false; } $conditions = $this->conditions(array( - $model->primaryKey => Set::extract($idList, "{n}.{$model->alias}.{$model->primaryKey}") + $model->primaryKey => Hash::extract($idList, "{n}.{$model->alias}.{$model->primaryKey}") )); } return $conditions; @@ -2256,7 +2256,7 @@ class DboSource extends DataSource { } else { if (strpos($fields[$i], ',') === false) { $build = explode('.', $fields[$i]); - if (!Set::numeric($build)) { + if (!Hash::numeric($build)) { $fields[$i] = $this->name(implode('.', $build)); } } @@ -2268,7 +2268,7 @@ class DboSource extends DataSource { $field[1] = $this->name($alias . '.' . $field[1]); } else { $field[0] = explode('.', $field[1]); - if (!Set::numeric($field[0])) { + if (!Hash::numeric($field[0])) { $field[0] = implode('.', array_map(array(&$this, 'name'), $field[0])); $fields[$i] = preg_replace('/\(' . $field[1] . '\)/', '(' . $field[0] . ')', $fields[$i], 1); } diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index a07c61186..a96d29c2d 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -1728,7 +1728,7 @@ class Model extends Object implements CakeEventListener { $this->getEventManager()->dispatch($event); } if (!empty($this->data)) { - $success = Set::merge($success, $this->data); + $success = Hash::merge($success, $this->data); } $this->data = false; $this->_clearCache(); @@ -1819,7 +1819,7 @@ class Model extends Object implements CakeEventListener { 'fields' => $associationForeignKey, )); - $oldLinks = Set::extract($links, "{n}.{$associationForeignKey}"); + $oldLinks = Hash::extract($links, "{n}.{$associationForeignKey}"); if (!empty($oldLinks)) { if ($keepExisting && !empty($newJoins)) { $conditions[$associationForeignKey] = array_diff($oldLinks, $newJoins); @@ -1993,7 +1993,7 @@ class Model extends Object implements CakeEventListener { */ public function saveAll($data = null, $options = array()) { $options = array_merge(array('validate' => 'first'), $options); - if (Set::numeric(array_keys($data))) { + if (Hash::numeric(array_keys($data))) { if ($options['validate'] === 'only') { return $this->validateMany($data, $options); } @@ -2514,7 +2514,7 @@ class Model extends Object implements CakeEventListener { return false; } - $ids = Set::extract($ids, "{n}.{$this->alias}.{$this->primaryKey}"); + $ids = Hash::extract($ids, "{n}.{$this->alias}.{$this->primaryKey}"); if (empty($ids)) { return true; } @@ -2837,7 +2837,7 @@ class Model extends Object implements CakeEventListener { return array(); } $lst = $query['list']; - return Set::combine($results, $lst['keyPath'], $lst['valuePath'], $lst['groupPath']); + return Hash::combine($results, $lst['keyPath'], $lst['valuePath'], $lst['groupPath']); } } @@ -2915,9 +2915,9 @@ class Model extends Object implements CakeEventListener { if (isset($query['parent'])) { $parent = $query['parent']; } - return Set::nest($results, array( - 'idPath' => '/' . $this->alias . '/' . $this->primaryKey, - 'parentPath' => '/' . $this->alias . '/' . $parent + return Hash::nest($results, array( + 'idPath' => '{n}.' . $this->alias . '.' . $this->primaryKey, + 'parentPath' => '{n}.' . $this->alias . '.' . $parent )); } } diff --git a/lib/Cake/Network/CakeRequest.php b/lib/Cake/Network/CakeRequest.php index 911a15a1b..bb43eb302 100644 --- a/lib/Cake/Network/CakeRequest.php +++ b/lib/Cake/Network/CakeRequest.php @@ -153,7 +153,7 @@ class CakeRequest implements ArrayAccess { * into a single array. Variables prefixed with `data` will overwrite those without. * * If you have mixed POST values be careful not to make any top level keys numeric - * containing arrays. Set::merge() is used to merge data, and it has possibly + * containing arrays. Hash::merge() is used to merge data, and it has possibly * unexpected behavior in this situation. * * @return void @@ -181,7 +181,7 @@ class CakeRequest implements ArrayAccess { $this->data = $data; } else { unset($this->data['data']); - $this->data = Set::merge($this->data, $data); + $this->data = Hash::merge($this->data, $data); } } } @@ -519,7 +519,7 @@ class CakeRequest implements ArrayAccess { public function addDetector($name, $options) { $name = strtolower($name); if (isset($this->_detectors[$name]) && isset($options['options'])) { - $options = Set::merge($this->_detectors[$name], $options); + $options = Hash::merge($this->_detectors[$name], $options); } $this->_detectors[$name] = $options; } @@ -748,10 +748,10 @@ class CakeRequest implements ArrayAccess { public function data($name) { $args = func_get_args(); if (count($args) == 2) { - $this->data = Set::insert($this->data, $name, $args[1]); + $this->data = Hash::insert($this->data, $name, $args[1]); return $this; } - return Set::classicExtract($this->data, $name); + return Hash::get($this->data, $name); } /** diff --git a/lib/Cake/Network/Email/CakeEmail.php b/lib/Cake/Network/Email/CakeEmail.php index 42bffc9cb..e22dd880a 100644 --- a/lib/Cake/Network/Email/CakeEmail.php +++ b/lib/Cake/Network/Email/CakeEmail.php @@ -1363,7 +1363,7 @@ class CakeEmail { $msg = array(); - $contentIds = array_filter((array)Set::classicExtract($this->_attachments, '{s}.contentId')); + $contentIds = array_filter((array)Hash::extract($this->_attachments, '{s}.contentId')); $hasInlineAttachments = count($contentIds) > 0; $hasAttachments = !empty($this->_attachments); $hasMultipleTypes = count($rendered) > 1; diff --git a/lib/Cake/Network/Http/HttpSocket.php b/lib/Cake/Network/Http/HttpSocket.php index 9ff65977f..43747da24 100644 --- a/lib/Cake/Network/Http/HttpSocket.php +++ b/lib/Cake/Network/Http/HttpSocket.php @@ -153,7 +153,7 @@ class HttpSocket extends CakeSocket { $this->_configUri($config['request']['uri']); unset($config['request']['uri']); } - $this->config = Set::merge($this->config, $config); + $this->config = Hash::merge($this->config, $config); } parent::__construct($this->config); } @@ -271,7 +271,7 @@ class HttpSocket extends CakeSocket { } $request['uri'] = $this->url($request['uri']); $request['uri'] = $this->_parseUri($request['uri'], true); - $this->request = Set::merge($this->request, array_diff_key($this->config['request'], array('cookies' => true)), $request); + $this->request = Hash::merge($this->request, array_diff_key($this->config['request'], array('cookies' => true)), $request); $this->_configUri($this->request['uri']); @@ -446,7 +446,7 @@ class HttpSocket extends CakeSocket { $uri = $this->_buildUri($uri); } - $request = Set::merge(array('method' => 'GET', 'uri' => $uri), $request); + $request = Hash::merge(array('method' => 'GET', 'uri' => $uri), $request); return $this->request($request); } @@ -468,7 +468,7 @@ class HttpSocket extends CakeSocket { * @return mixed Result of request, either false on failure or the response to the request. */ public function post($uri = null, $data = array(), $request = array()) { - $request = Set::merge(array('method' => 'POST', 'uri' => $uri, 'body' => $data), $request); + $request = Hash::merge(array('method' => 'POST', 'uri' => $uri, 'body' => $data), $request); return $this->request($request); } @@ -481,7 +481,7 @@ class HttpSocket extends CakeSocket { * @return mixed Result of request */ public function put($uri = null, $data = array(), $request = array()) { - $request = Set::merge(array('method' => 'PUT', 'uri' => $uri, 'body' => $data), $request); + $request = Hash::merge(array('method' => 'PUT', 'uri' => $uri, 'body' => $data), $request); return $this->request($request); } @@ -494,7 +494,7 @@ class HttpSocket extends CakeSocket { * @return mixed Result of request */ public function delete($uri = null, $data = array(), $request = array()) { - $request = Set::merge(array('method' => 'DELETE', 'uri' => $uri, 'body' => $data), $request); + $request = Hash::merge(array('method' => 'DELETE', 'uri' => $uri, 'body' => $data), $request); return $this->request($request); } @@ -639,8 +639,8 @@ class HttpSocket extends CakeSocket { 'uri' => array_intersect_key($uri, $this->config['request']['uri']) ) ); - $this->config = Set::merge($this->config, $config); - $this->config = Set::merge($this->config, array_intersect_key($this->config['request']['uri'], $this->config)); + $this->config = Hash::merge($this->config, $config); + $this->config = Hash::merge($this->config, array_intersect_key($this->config['request']['uri'], $this->config)); return true; } diff --git a/lib/Cake/Routing/Route/CakeRoute.php b/lib/Cake/Routing/Route/CakeRoute.php index 2c2343b71..4744a3077 100644 --- a/lib/Cake/Routing/Route/CakeRoute.php +++ b/lib/Cake/Routing/Route/CakeRoute.php @@ -494,7 +494,7 @@ class CakeRoute { $named = array(); foreach ($params['named'] as $key => $value) { if (is_array($value)) { - $flat = Set::flatten($value, ']['); + $flat = Hash::flatten($value, ']['); foreach ($flat as $namedKey => $namedValue) { $named[] = $key . "[$namedKey]" . $separator . rawurlencode($namedValue); } diff --git a/lib/Cake/Routing/Router.php b/lib/Cake/Routing/Router.php index a7bad5563..f92a4d412 100644 --- a/lib/Cake/Routing/Router.php +++ b/lib/Cake/Routing/Router.php @@ -890,7 +890,7 @@ class Router { } } - list($args, $named) = array(Set::filter($args, true), Set::filter($named, true)); + list($args, $named) = array(Hash::filter($args), Hash::filter($named)); foreach (self::$_prefixes as $prefix) { if (!empty($url[$prefix])) { $url['action'] = str_replace($prefix . '_', '', $url['action']); @@ -923,7 +923,7 @@ class Router { if (!empty($named)) { foreach ($named as $name => $value) { if (is_array($value)) { - $flattend = Set::flatten($value, ']['); + $flattend = Hash::flatten($value, ']['); foreach ($flattend as $namedKey => $namedValue) { $output .= '/' . $name . "[$namedKey]" . self::$_namedConfig['separator'] . rawurlencode($namedValue); } diff --git a/lib/Cake/Test/Case/Console/ShellTest.php b/lib/Cake/Test/Case/Console/ShellTest.php index 4e75b29b9..44427410c 100644 --- a/lib/Cake/Test/Case/Console/ShellTest.php +++ b/lib/Cake/Test/Case/Console/ShellTest.php @@ -161,7 +161,7 @@ class ShellTest extends CakeTestCase { $this->assertEquals($expected, $this->Shell->tasks); $expected = array('Fixture' => null, 'DbConfig' => array('one', 'two')); - $this->assertEquals($expected, Set::normalize($this->Shell->tasks), 'Normalized results are wrong.'); + $this->assertEquals($expected, Hash::normalize($this->Shell->tasks), 'Normalized results are wrong.'); $this->assertEquals(array('Comment', 'Posts'), $this->Shell->uses, 'Merged models are wrong.'); } diff --git a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php index 693cf8f5f..11da7bb9f 100644 --- a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php @@ -108,7 +108,7 @@ class PaginatorControllerPost extends CakeTestModel { public function find($conditions = null, $fields = array(), $order = null, $recursive = null) { if ($conditions == 'popular') { $conditions = array($this->name . '.' . $this->primaryKey . ' > ' => '1'); - $options = Set::merge($fields, compact('conditions')); + $options = Hash::merge($fields, compact('conditions')); return parent::find('all', $options); } return parent::find($conditions, $fields); @@ -352,47 +352,47 @@ class PaginatorComponentTest extends CakeTestCase { $Controller->request->query = array(); $Controller->constructClasses(); - $results = Set::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id'); + $results = Hash::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id'); $this->assertEquals(array(1, 2, 3), $results); - $results = Set::extract($Controller->Paginator->paginate('PaginatorControllerComment'), '{n}.PaginatorControllerComment.id'); + $results = Hash::extract($Controller->Paginator->paginate('PaginatorControllerComment'), '{n}.PaginatorControllerComment.id'); $this->assertEquals(array(1, 2, 3, 4, 5, 6), $results); $Controller->modelClass = null; $Controller->uses[0] = 'Plugin.PaginatorControllerPost'; - $results = Set::extract($Controller->Paginator->paginate(), '{n}.PaginatorControllerPost.id'); + $results = Hash::extract($Controller->Paginator->paginate(), '{n}.PaginatorControllerPost.id'); $this->assertEquals(array(1, 2, 3), $results); $Controller->request->params['named'] = array('page' => '-1'); - $results = Set::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id'); + $results = Hash::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id'); $this->assertEquals(1, $Controller->params['paging']['PaginatorControllerPost']['page']); $this->assertEquals(array(1, 2, 3), $results); $Controller->request->params['named'] = array('sort' => 'PaginatorControllerPost.id', 'direction' => 'asc'); - $results = Set::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id'); + $results = Hash::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id'); $this->assertEquals(1, $Controller->params['paging']['PaginatorControllerPost']['page']); $this->assertEquals(array(1, 2, 3), $results); $Controller->request->params['named'] = array('sort' => 'PaginatorControllerPost.id', 'direction' => 'desc'); - $results = Set::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id'); + $results = Hash::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id'); $this->assertEquals(1, $Controller->params['paging']['PaginatorControllerPost']['page']); $this->assertEquals(array(3, 2, 1), $results); $Controller->request->params['named'] = array('sort' => 'id', 'direction' => 'desc'); - $results = Set::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id'); + $results = Hash::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id'); $this->assertEquals(1, $Controller->params['paging']['PaginatorControllerPost']['page']); $this->assertEquals(array(3, 2, 1), $results); $Controller->request->params['named'] = array('sort' => 'NotExisting.field', 'direction' => 'desc'); - $results = Set::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id'); + $results = Hash::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id'); $this->assertEquals(1, $Controller->params['paging']['PaginatorControllerPost']['page'], 'Invalid field in query %s'); $this->assertEquals(array(1, 2, 3), $results); $Controller->request->params['named'] = array( 'sort' => 'PaginatorControllerPost.author_id', 'direction' => 'allYourBase' ); - $results = Set::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id'); + $results = Hash::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id'); $this->assertEquals(array('PaginatorControllerPost.author_id' => 'asc'), $Controller->PaginatorControllerPost->lastQueries[1]['order'][0]); $this->assertEquals(array(1, 3, 2), $results); @@ -469,7 +469,7 @@ class PaginatorComponentTest extends CakeTestCase { $Controller->request->params['named'] = array('page' => '-1', 'contain' => array('PaginatorControllerComment')); $result = $Controller->Paginator->paginate('PaginatorControllerPost'); $this->assertEquals(1, $Controller->params['paging']['PaginatorControllerPost']['page']); - $this->assertEquals(array(1, 2, 3), Set::extract($result, '{n}.PaginatorControllerPost.id')); + $this->assertEquals(array(1, 2, 3), Hash::extract($result, '{n}.PaginatorControllerPost.id')); $this->assertTrue(!isset($Controller->PaginatorControllerPost->lastQueries[1]['contain'])); $Controller->request->params['named'] = array('page' => '-1'); @@ -482,7 +482,7 @@ class PaginatorComponentTest extends CakeTestCase { ); $result = $Controller->Paginator->paginate('PaginatorControllerPost'); $this->assertEquals(1, $Controller->params['paging']['PaginatorControllerPost']['page']); - $this->assertEquals(array(1, 2, 3), Set::extract($result, '{n}.PaginatorControllerPost.id')); + $this->assertEquals(array(1, 2, 3), Hash::extract($result, '{n}.PaginatorControllerPost.id')); $this->assertTrue(isset($Controller->PaginatorControllerPost->lastQueries[1]['contain'])); $Controller->Paginator->settings = array( @@ -491,7 +491,7 @@ class PaginatorComponentTest extends CakeTestCase { ), ); $result = $Controller->Paginator->paginate('PaginatorControllerPost'); - $this->assertEquals(array(2, 3), Set::extract($result, '{n}.PaginatorControllerPost.id')); + $this->assertEquals(array(2, 3), Hash::extract($result, '{n}.PaginatorControllerPost.id')); $this->assertEquals(array('PaginatorControllerPost.id > ' => '1'), $Controller->PaginatorControllerPost->lastQueries[1]['conditions']); $Controller->request->params['named'] = array('limit' => 12); @@ -566,7 +566,7 @@ class PaginatorComponentTest extends CakeTestCase { ); $result = $Controller->Paginator->paginate('PaginatorControllerPost'); - $this->assertEquals(array(2, 3), Set::extract($result, '{n}.PaginatorControllerPost.id')); + $this->assertEquals(array(2, 3), Hash::extract($result, '{n}.PaginatorControllerPost.id')); $this->assertEquals( $Controller->PaginatorControllerPost->lastQueries[1]['conditions'], array('PaginatorControllerPost.id > ' => '1') @@ -589,7 +589,7 @@ class PaginatorComponentTest extends CakeTestCase { 'maxLimit' => 10, 'paramType' => 'named' ); - $results = Set::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id'); + $results = Hash::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id'); $this->assertEquals('PaginatorControllerPost.id DESC', $Controller->params['paging']['PaginatorControllerPost']['order']); $this->assertEquals(array(3, 2, 1), $results); } @@ -615,7 +615,7 @@ class PaginatorComponentTest extends CakeTestCase { 'paramType' => 'named' ); $result = $Controller->Paginator->paginate('PaginatorControllerPost'); - $this->assertEquals(array(4, 3, 2), Set::extract($result, '{n}.PaginatorControllerPost.offset_test')); + $this->assertEquals(array(4, 3, 2), Hash::extract($result, '{n}.PaginatorControllerPost.offset_test')); $Controller->request->params['named'] = array('sort' => 'offset_test', 'direction' => 'asc'); $result = $Controller->Paginator->paginate('PaginatorControllerPost'); @@ -639,11 +639,11 @@ class PaginatorComponentTest extends CakeTestCase { 'paramType' => 'named' ); $result = $Controller->Paginator->paginate('PaginatorControllerPost'); - $this->assertEquals(array(4, 2, 2), Set::extract($result, '{n}.PaginatorAuthor.joined_offset')); + $this->assertEquals(array(4, 2, 2), Hash::extract($result, '{n}.PaginatorAuthor.joined_offset')); $Controller->request->params['named'] = array('sort' => 'PaginatorAuthor.joined_offset', 'direction' => 'asc'); $result = $Controller->Paginator->paginate('PaginatorControllerPost'); - $this->assertEquals(array(2, 2, 4), Set::extract($result, '{n}.PaginatorAuthor.joined_offset')); + $this->assertEquals(array(2, 2, 4), Hash::extract($result, '{n}.PaginatorAuthor.joined_offset')); } /** @@ -968,7 +968,7 @@ class PaginatorComponentTest extends CakeTestCase { ); $Controller->passedArgs = array('sort' => 'PaginatorControllerPost.title', 'dir' => 'asc'); $result = $Controller->paginate('PaginatorControllerComment'); - $this->assertEquals(array(1, 2, 3, 4, 5, 6), Set::extract($result, '{n}.PaginatorControllerComment.id')); + $this->assertEquals(array(1, 2, 3, 4, 5, 6), Hash::extract($result, '{n}.PaginatorControllerComment.id')); } /** diff --git a/lib/Cake/Test/Case/Controller/ControllerTest.php b/lib/Cake/Test/Case/Controller/ControllerTest.php index b2b0a1ba3..94db2a9f1 100644 --- a/lib/Cake/Test/Case/Controller/ControllerTest.php +++ b/lib/Cake/Test/Case/Controller/ControllerTest.php @@ -104,7 +104,7 @@ class ControllerPost extends CakeTestModel { public function find($type = 'first', $options = array()) { if ($type == 'popular') { $conditions = array($this->name . '.' . $this->primaryKey . ' > ' => '1'); - $options = Set::merge($options, compact('conditions')); + $options = Hash::merge($options, compact('conditions')); return parent::find('all', $options); } return parent::find($type, $options); @@ -898,7 +898,7 @@ class ControllerTest extends CakeTestCase { $this->assertEquals(0, count(array_diff_key($TestController->helpers, array_flip($helpers)))); $this->assertEquals(0, count(array_diff($TestController->uses, $uses))); - $this->assertEquals(count(array_diff_assoc(Set::normalize($TestController->components), Set::normalize($components))), 0); + $this->assertEquals(count(array_diff_assoc(Hash::normalize($TestController->components), Hash::normalize($components))), 0); $expected = array('ControllerComment', 'ControllerAlias', 'ControllerPost'); $this->assertEquals($expected, $TestController->uses, '$uses was merged incorrectly, ControllerTestAppController models should be last.'); @@ -1275,7 +1275,7 @@ class ControllerTest extends CakeTestCase { $expected = array('page' => 1, 'limit' => 20, 'maxLimit' => 100, 'paramType' => 'named'); $this->assertEquals($expected, $Controller->paginate); - $results = Set::extract($Controller->paginate('ControllerPost'), '{n}.ControllerPost.id'); + $results = Hash::extract($Controller->paginate('ControllerPost'), '{n}.ControllerPost.id'); $this->assertEquals(array(1, 2, 3), $results); $Controller->passedArgs = array(); diff --git a/lib/Cake/Test/Case/Model/AclNodeTest.php b/lib/Cake/Test/Case/Model/AclNodeTest.php index 234788a1e..605e9a0c5 100644 --- a/lib/Cake/Test/Case/Model/AclNodeTest.php +++ b/lib/Cake/Test/Case/Model/AclNodeTest.php @@ -254,35 +254,33 @@ class AclNodeTest extends CakeTestCase { */ public function testNode() { $Aco = new DbAcoTest(); - $result = Set::extract($Aco->node('Controller1'), '{n}.DbAcoTest.id'); + $result = Hash::extract($Aco->node('Controller1'), '{n}.DbAcoTest.id'); $expected = array(2, 1); $this->assertEquals($expected, $result); - $result = Set::extract($Aco->node('Controller1/action1'), '{n}.DbAcoTest.id'); + $result = Hash::extract($Aco->node('Controller1/action1'), '{n}.DbAcoTest.id'); $expected = array(3, 2, 1); $this->assertEquals($expected, $result); - $result = Set::extract($Aco->node('Controller2/action1'), '{n}.DbAcoTest.id'); + $result = Hash::extract($Aco->node('Controller2/action1'), '{n}.DbAcoTest.id'); $expected = array(7, 6, 1); $this->assertEquals($expected, $result); - $result = Set::extract($Aco->node('Controller1/action2'), '{n}.DbAcoTest.id'); + $result = Hash::extract($Aco->node('Controller1/action2'), '{n}.DbAcoTest.id'); $expected = array(5, 2, 1); $this->assertEquals($expected, $result); - $result = Set::extract($Aco->node('Controller1/action1/record1'), '{n}.DbAcoTest.id'); + $result = Hash::extract($Aco->node('Controller1/action1/record1'), '{n}.DbAcoTest.id'); $expected = array(4, 3, 2, 1); $this->assertEquals($expected, $result); - $result = Set::extract($Aco->node('Controller2/action1/record1'), '{n}.DbAcoTest.id'); + $result = Hash::extract($Aco->node('Controller2/action1/record1'), '{n}.DbAcoTest.id'); $expected = array(8, 7, 6, 1); $this->assertEquals($expected, $result); - $result = Set::extract($Aco->node('Controller2/action3'), '{n}.DbAcoTest.id'); - $this->assertNull($result); + $this->assertFalse($Aco->node('Controller2/action3')); - $result = Set::extract($Aco->node('Controller2/action3/record5'), '{n}.DbAcoTest.id'); - $this->assertNull($result); + $this->assertFalse($Aco->node('Controller2/action3/record5')); $result = $Aco->node(''); $this->assertEquals(null, $result); @@ -307,12 +305,12 @@ class AclNodeTest extends CakeTestCase { public function testNodeArrayFind() { $Aro = new DbAroTest(); Configure::write('DbAclbindMode', 'string'); - $result = Set::extract($Aro->node(array('DbAroUserTest' => array('id' => '1', 'foreign_key' => '1'))), '{n}.DbAroTest.id'); + $result = Hash::extract($Aro->node(array('DbAroUserTest' => array('id' => '1', 'foreign_key' => '1'))), '{n}.DbAroTest.id'); $expected = array(3, 2, 1); $this->assertEquals($expected, $result); Configure::write('DbAclbindMode', 'array'); - $result = Set::extract($Aro->node(array('DbAroUserTest' => array('id' => 4, 'foreign_key' => 2))), '{n}.DbAroTest.id'); + $result = Hash::extract($Aro->node(array('DbAroUserTest' => array('id' => 4, 'foreign_key' => 2))), '{n}.DbAroTest.id'); $expected = array(4); $this->assertEquals($expected, $result); } @@ -326,12 +324,12 @@ class AclNodeTest extends CakeTestCase { $Aro = new DbAroTest(); $Model = new DbAroUserTest(); $Model->id = 1; - $result = Set::extract($Aro->node($Model), '{n}.DbAroTest.id'); + $result = Hash::extract($Aro->node($Model), '{n}.DbAroTest.id'); $expected = array(3, 2, 1); $this->assertEquals($expected, $result); $Model->id = 2; - $result = Set::extract($Aro->node($Model), '{n}.DbAroTest.id'); + $result = Hash::extract($Aro->node($Model), '{n}.DbAroTest.id'); $expected = array(4, 2, 1); $this->assertEquals($expected, $result); } @@ -379,7 +377,7 @@ class AclNodeTest extends CakeTestCase { $this->assertEquals($expected, $result); $node = $Aro->node(array('TestPlugin.TestPluginAuthUser' => array('id' => 1, 'user' => 'mariano'))); - $result = Set::extract($node, '0.DbAroTest.id'); + $result = Hash::get($node, '0.DbAroTest.id'); $expected = $Aro->id; $this->assertEquals($expected, $result); CakePlugin::unload('TestPlugin'); diff --git a/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php b/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php index e6d6e8f0a..d517c948a 100644 --- a/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php +++ b/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php @@ -631,8 +631,8 @@ class TranslateBehaviorTest extends CakeTestCase { $translations = array('title' => 'Title', 'content' => 'Content'); $TestModel->bindTranslation($translations, false); $result = $TestModel->read(null, 1); - $result['Title'] = Set::sort($result['Title'], '{n}.id', 'asc'); - $result['Content'] = Set::sort($result['Content'], '{n}.id', 'asc'); + $result['Title'] = Hash::sort($result['Title'], '{n}.id', 'asc'); + $result['Content'] = Hash::sort($result['Content'], '{n}.id', 'asc'); $expected = array( 'TranslatedItem' => array('id' => 1, 'slug' => 'first_translated', 'locale' => 'cze', 'title' => 'Titulek #1', 'content' => 'Upraveny obsah #1'), 'Title' => array( diff --git a/lib/Cake/Test/Case/Model/BehaviorCollectionTest.php b/lib/Cake/Test/Case/Model/BehaviorCollectionTest.php index d52bcf961..e6dcd1ba1 100644 --- a/lib/Cake/Test/Case/Model/BehaviorCollectionTest.php +++ b/lib/Cake/Test/Case/Model/BehaviorCollectionTest.php @@ -102,7 +102,7 @@ class TestBehavior extends ModelBehavior { return null; break; case 'modify': - return Set::extract($results, "{n}.{$model->alias}"); + return Hash::extract($results, "{n}.{$model->alias}"); break; } } @@ -839,7 +839,7 @@ class BehaviorCollectionTest extends CakeTestCase { $this->assertSame($expected, $result); $Sample->Behaviors->attach('Test', array('beforeSave' => 'modify')); - $expected = Set::insert($record, 'Sample.name', 'sample99 modified before'); + $expected = Hash::insert($record, 'Sample.name', 'sample99 modified before'); $Sample->create(); $result = $Sample->save($record); $expected['Sample']['id'] = $Sample->id; @@ -849,14 +849,14 @@ class BehaviorCollectionTest extends CakeTestCase { $this->assertSame($record, $Sample->save($record)); $Sample->Behaviors->attach('Test', array('beforeSave' => 'off', 'afterSave' => 'on')); - $expected = Set::merge($record, array('Sample' => array('aftersave' => 'modified after on create'))); + $expected = Hash::merge($record, array('Sample' => array('aftersave' => 'modified after on create'))); $Sample->create(); $result = $Sample->save($record); $expected['Sample']['id'] = $Sample->id; $this->assertEquals($expected, $result); $Sample->Behaviors->attach('Test', array('beforeSave' => 'modify', 'afterSave' => 'modify')); - $expected = Set::merge($record, array('Sample' => array('name' => 'sample99 modified before modified after on create'))); + $expected = Hash::merge($record, array('Sample' => array('name' => 'sample99 modified before modified after on create'))); $Sample->create(); $result = $Sample->save($record); $expected['Sample']['id'] = $Sample->id; @@ -881,12 +881,12 @@ class BehaviorCollectionTest extends CakeTestCase { $record2 = $Sample->read(null, 1); $Sample->Behaviors->attach('Test', array('afterSave' => 'on')); - $expected = Set::merge($record2, array('Sample' => array('aftersave' => 'modified after'))); + $expected = Hash::merge($record2, array('Sample' => array('aftersave' => 'modified after'))); $Sample->create(); $this->assertSame($expected, $Sample->save($record2)); $Sample->Behaviors->attach('Test', array('afterSave' => 'modify')); - $expected = Set::merge($record2, array('Sample' => array('name' => 'sample1 modified after'))); + $expected = Hash::merge($record2, array('Sample' => array('name' => 'sample1 modified after'))); $Sample->create(); $this->assertSame($expected, $Sample->save($record2)); } diff --git a/lib/Cake/Test/Case/Model/ModelReadTest.php b/lib/Cake/Test/Case/Model/ModelReadTest.php index df45ce514..6254ceb97 100644 --- a/lib/Cake/Test/Case/Model/ModelReadTest.php +++ b/lib/Cake/Test/Case/Model/ModelReadTest.php @@ -3015,7 +3015,7 @@ class ModelReadTest extends BaseModelTest { $this->loadFixtures('Apple', 'Sample'); $Apple = new Apple(); $result = $Apple->find('threaded'); - $result = Set::extract($result, '{n}.children'); + $result = Hash::extract($result, '{n}.children'); $expected = array(array(), array(), array(), array(), array(), array(), array()); $this->assertEquals($expected, $result); } @@ -3030,7 +3030,7 @@ class ModelReadTest extends BaseModelTest { $Model = new Person(); $Model->recursive = -1; $result = $Model->find('threaded'); - $result = Set::extract($result, '{n}.children'); + $result = Hash::extract($result, '{n}.children'); $expected = array(array(), array(), array(), array(), array(), array(), array()); $this->assertEquals($expected, $result); @@ -6479,7 +6479,7 @@ class ModelReadTest extends BaseModelTest { $this->assertEquals($expected, $result); } - $result = Set::combine( + $result = Hash::combine( $TestModel->find('all', array( 'order' => 'Article.title ASC', 'fields' => array('id', 'title') @@ -6493,7 +6493,7 @@ class ModelReadTest extends BaseModelTest { ); $this->assertEquals($expected, $result); - $result = Set::combine( + $result = Hash::combine( $TestModel->find('all', array( 'order' => 'Article.title ASC' )), @@ -6530,7 +6530,7 @@ class ModelReadTest extends BaseModelTest { $this->assertEquals($expected, $result); - $result = Set::combine( + $result = Hash::combine( $TestModel->find('all', array( 'order' => 'Article.title ASC' )), @@ -6569,7 +6569,7 @@ class ModelReadTest extends BaseModelTest { $this->assertEquals($expected, $result); - $result = Set::combine( + $result = Hash::combine( $TestModel->find('all', array( 'order' => 'Article.title ASC', 'fields' => array('id', 'title', 'user_id') @@ -7689,17 +7689,17 @@ class ModelReadTest extends BaseModelTest { $Post->Author->virtualFields = array('joined' => 'Post.id * Author.id'); $result = $Post->find('all'); - $result = Set::extract('{n}.Author.joined', $result); + $result = Hash::extract($result, '{n}.Author.joined'); $expected = array(1, 6, 3); $this->assertEquals($expected, $result); $result = $Post->find('all', array('order' => array('Author.joined' => 'ASC'))); - $result = Set::extract('{n}.Author.joined', $result); + $result = Hash::extract($result, '{n}.Author.joined'); $expected = array(1, 3, 6); $this->assertEquals($expected, $result); $result = $Post->find('all', array('order' => array('Author.joined' => 'DESC'))); - $result = Set::extract('{n}.Author.joined', $result); + $result = Hash::extract($result, '{n}.Author.joined'); $expected = array(6, 3, 1); $this->assertEquals($expected, $result); } diff --git a/lib/Cake/Test/Case/Model/ModelWriteTest.php b/lib/Cake/Test/Case/Model/ModelWriteTest.php index 8161a1db5..ed1dc0ed1 100644 --- a/lib/Cake/Test/Case/Model/ModelWriteTest.php +++ b/lib/Cake/Test/Case/Model/ModelWriteTest.php @@ -411,7 +411,7 @@ class ModelWriteTest extends BaseModelTest { $Category = new CategoryThread(); $Category->belongsTo['ParentCategory']['counterCache'] = 'child_count'; $Category->updateCounterCache(array('parent_id' => 5)); - $result = Set::extract($Category->find('all', array('conditions' => array('CategoryThread.id' => 5))), '{n}.CategoryThread.child_count'); + $result = Hash::extract($Category->find('all', array('conditions' => array('CategoryThread.id' => 5))), '{n}.CategoryThread.child_count'); $expected = array(1); $this->assertEquals($expected, $result); } @@ -1680,7 +1680,7 @@ class ModelWriteTest extends BaseModelTest { $TestModel->id = 2; $TestModel->save($data); $result = $TestModel->findById(2); - $result['Item'] = Set::sort($result['Item'], '{n}.id', 'asc'); + $result['Item'] = Hash::sort($result['Item'], '{n}.id', 'asc'); $expected = array( 'Portfolio' => array( 'id' => 2, @@ -2400,12 +2400,12 @@ class ModelWriteTest extends BaseModelTest { public function testUpdateMultiple() { $this->loadFixtures('Comment', 'Article', 'User', 'CategoryThread'); $TestModel = new Comment(); - $result = Set::extract($TestModel->find('all'), '{n}.Comment.user_id'); + $result = Hash::extract($TestModel->find('all'), '{n}.Comment.user_id'); $expected = array('2', '4', '1', '1', '1', '2'); $this->assertEquals($expected, $result); $TestModel->updateAll(array('Comment.user_id' => 5), array('Comment.user_id' => 2)); - $result = Set::combine($TestModel->find('all'), '{n}.Comment.id', '{n}.Comment.user_id'); + $result = Hash::combine($TestModel->find('all'), '{n}.Comment.id', '{n}.Comment.user_id'); $expected = array(1 => 5, 2 => 4, 3 => 1, 4 => 1, 5 => 1, 6 => 5); $this->assertEquals($expected, $result); @@ -2414,7 +2414,7 @@ class ModelWriteTest extends BaseModelTest { array('Comment.user_id' => 5) ); $this->assertFalse(empty($result)); - $result = Set::extract( + $result = Hash::extract( $TestModel->find('all', array( 'conditions' => array( 'Comment.user_id' => 5 @@ -3075,7 +3075,7 @@ class ModelWriteTest extends BaseModelTest { 'First new comment', 'Second new comment' ); - $result = Set::extract(Set::sort($result['Comment'], '{n}.id', 'ASC'), '{n}.comment'); + $result = Hash::extract(Hash::sort($result['Comment'], '{n}.id', 'ASC'), '{n}.comment'); $this->assertEquals($expected, $result); $result = $TestModel->Comment->User->field('id', array('user' => 'newuser', 'password' => 'newuserpass')); @@ -3098,7 +3098,7 @@ class ModelWriteTest extends BaseModelTest { 'Third new comment', 'Fourth new comment' ); - $result = Set::extract(Set::sort($result['Comment'], '{n}.id', 'ASC'), '{n}.comment'); + $result = Hash::extract(Hash::sort($result['Comment'], '{n}.id', 'ASC'), '{n}.comment'); $this->assertEquals($expected, $result); $result = $TestModel->Comment->Attachment->field('id', array('attachment' => 'deepsaved')); @@ -3850,7 +3850,7 @@ class ModelWriteTest extends BaseModelTest { 'First new comment', 'Second new comment' ); - $result = Set::extract(Set::sort($result['Comment'], '{n}.id', 'ASC'), '{n}.comment'); + $result = Hash::extract(Hash::sort($result['Comment'], '{n}.id', 'ASC'), '{n}.comment'); $this->assertEquals($expected, $result); $result = $TestModel->saveAll( @@ -3874,7 +3874,7 @@ class ModelWriteTest extends BaseModelTest { 'Second new comment', 'Third new comment' ); - $result = Set::extract(Set::sort($result['Comment'], '{n}.id', 'ASC'), '{n}.comment'); + $result = Hash::extract(Hash::sort($result['Comment'], '{n}.id', 'ASC'), '{n}.comment'); $this->assertEquals($expected, $result); $TestModel->beforeSaveReturn = false; @@ -3899,7 +3899,7 @@ class ModelWriteTest extends BaseModelTest { 'Second new comment', 'Third new comment' ); - $result = Set::extract(Set::sort($result['Comment'], '{n}.id', 'ASC'), '{n}.comment'); + $result = Hash::extract(Hash::sort($result['Comment'], '{n}.id', 'ASC'), '{n}.comment'); $this->assertEquals($expected, $result); } diff --git a/lib/Cake/Test/Case/Network/Http/HttpSocketTest.php b/lib/Cake/Test/Case/Network/Http/HttpSocketTest.php index 0051c2971..8be0f31d3 100644 --- a/lib/Cake/Test/Case/Network/Http/HttpSocketTest.php +++ b/lib/Cake/Test/Case/Network/Http/HttpSocketTest.php @@ -531,13 +531,13 @@ class HttpSocketTest extends CakeTestCase { foreach ($tests as $i => $test) { if (strpos($i, 'reset') === 0) { foreach ($test as $path => $val) { - $expectation = Set::insert($expectation, $path, $val); + $expectation = Hash::insert($expectation, $path, $val); } continue; } if (isset($test['expectation'])) { - $expectation = Set::merge($expectation, $test['expectation']); + $expectation = Hash::merge($expectation, $test['expectation']); } $this->Socket->request($test['request']); diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index 4153a6111..62dab98f7 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -6860,7 +6860,7 @@ class FormHelperTest extends CakeTestCase { $result = $this->Form->input('Contact.non_existing'); $expected = array( - 'div' => array('class' => 'input text required'), + 'div' => array('class' => 'input text'), 'label' => array('for' => 'ContactNonExisting'), 'Non Existing', '/label', diff --git a/lib/Cake/Utility/Debugger.php b/lib/Cake/Utility/Debugger.php index 9ed57d1d9..d503fc2f5 100644 --- a/lib/Cake/Utility/Debugger.php +++ b/lib/Cake/Utility/Debugger.php @@ -288,7 +288,7 @@ class Debugger { 'scope' => null, 'exclude' => array('call_user_func_array', 'trigger_error') ); - $options = Set::merge($defaults, $options); + $options = Hash::merge($defaults, $options); $backtrace = debug_backtrace(); $count = count($backtrace); diff --git a/lib/Cake/Utility/Hash.php b/lib/Cake/Utility/Hash.php index 1b6930652..6a2b7f465 100644 --- a/lib/Cake/Utility/Hash.php +++ b/lib/Cake/Utility/Hash.php @@ -317,7 +317,7 @@ class Hash { /** * Creates an associative array using `$keyPath` as the path to build its keys, and optionally * `$valuePath` as path to get the values. If `$valuePath` is not specified, all values will be initialized - * to null (useful for Set::merge). You can optionally group the values by what is obtained when + * to null (useful for Hash::merge). You can optionally group the values by what is obtained when * following the path specified in `$groupPath`. * * @param array $data Array from where to extract keys and values @@ -383,7 +383,7 @@ class Hash { * Usage: * * {{{ - * $result = Set::format($users, array('{n}.User.id', '{n}.User.name'), '%s : %s'); + * $result = Hash::format($users, array('{n}.User.id', '{n}.User.name'), '%s : %s'); * }}} * * The `$format` string can use any format options that `vsprintf()` and `sprintf()` do. @@ -405,7 +405,7 @@ class Hash { } for ($i = 0; $i < $count; $i++) { - $extracted[] = Set::extract($data, $paths[$i]); + $extracted[] = self::extract($data, $paths[$i]); } $out = array(); $data = $extracted; @@ -639,7 +639,7 @@ class Hash { $depth = array(); if (is_array($data) && reset($data) !== false) { foreach ($data as $value) { - $depth[] = Hash::dimensions((array)$value) + 1; + $depth[] = self::dimensions((array)$value) + 1; } } return max($depth); @@ -830,7 +830,7 @@ class Hash { * @param mixed $data The data to nest. * @param array $options Options are: * @return array of results, nested - * @see Set::extract() + * @see Hash::extract() */ public static function nest(array $data, $options = array()) { if (!$data) { diff --git a/lib/Cake/View/Helper.php b/lib/Cake/View/Helper.php index 284087e2c..98d12a663 100644 --- a/lib/Cake/View/Helper.php +++ b/lib/Cake/View/Helper.php @@ -471,7 +471,7 @@ class Helper extends Object { if ($setScope === true) { $this->_modelScope = $entity; } - $parts = array_values(Set::filter(explode('.', $entity), true)); + $parts = array_values(Hash::filter(explode('.', $entity))); if (empty($parts)) { return; } @@ -673,7 +673,7 @@ class Helper extends Object { $entity = $this->entity(); if (!empty($data) && !empty($entity)) { - $result = Set::extract(implode('.', $entity), $data); + $result = Hash::get($data, implode('.', $entity)); } $habtmKey = $this->field(); diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 09a02e870..21f245e19 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -243,7 +243,7 @@ class FormHelper extends AppHelper { return true; } elseif (is_array($validateProperties)) { - $dims = Set::countDim($validateProperties); + $dims = Hash::dimensions($validateProperties); if ($dims == 1 || ($dims == 2 && isset($validateProperties['rule']))) { $validateProperties = array($validateProperties); } @@ -312,7 +312,7 @@ class FormHelper extends AppHelper { if (empty($errors)) { return false; } - $errors = Set::classicExtract($errors, join('.', $entity)); + $errors = Hash::get($errors, join('.', $entity)); return $errors === null ? false : $errors; } @@ -623,7 +623,7 @@ class FormHelper extends AppHelper { if (!$field) { $field = $this->entity(); } elseif (is_string($field)) { - $field = Set::filter(explode('.', $field), true); + $field = Hash::filter(explode('.', $field)); } foreach ($this->_unlockedFields as $unlockField) { diff --git a/lib/Cake/View/Helper/NumberHelper.php b/lib/Cake/View/Helper/NumberHelper.php index 1a82d6355..58894843e 100644 --- a/lib/Cake/View/Helper/NumberHelper.php +++ b/lib/Cake/View/Helper/NumberHelper.php @@ -53,7 +53,7 @@ class NumberHelper extends AppHelper { * @throws CakeException When the engine class could not be found. */ public function __construct(View $View, $settings = array()) { - $settings = Set::merge(array('engine' => 'CakeNumber'), $settings); + $settings = Hash::merge(array('engine' => 'CakeNumber'), $settings); parent::__construct($View, $settings); list($plugin, $engineClass) = pluginSplit($settings['engine'], true); App::uses($engineClass, $plugin . 'Utility'); diff --git a/lib/Cake/View/Helper/TextHelper.php b/lib/Cake/View/Helper/TextHelper.php index d825fc5aa..9f9ae9b91 100644 --- a/lib/Cake/View/Helper/TextHelper.php +++ b/lib/Cake/View/Helper/TextHelper.php @@ -66,7 +66,7 @@ class TextHelper extends AppHelper { * @throws CakeException when the engine class could not be found. */ public function __construct(View $View, $settings = array()) { - $settings = Set::merge(array('engine' => 'String'), $settings); + $settings = Hash::merge(array('engine' => 'String'), $settings); parent::__construct($View, $settings); list($plugin, $engineClass) = pluginSplit($settings['engine'], true); App::uses($engineClass, $plugin . 'Utility'); diff --git a/lib/Cake/View/Helper/TimeHelper.php b/lib/Cake/View/Helper/TimeHelper.php index 57c418c5f..9112d5a88 100644 --- a/lib/Cake/View/Helper/TimeHelper.php +++ b/lib/Cake/View/Helper/TimeHelper.php @@ -50,7 +50,7 @@ class TimeHelper extends AppHelper { * @throws CakeException When the engine class could not be found. */ public function __construct(View $View, $settings = array()) { - $settings = Set::merge(array('engine' => 'CakeTime'), $settings); + $settings = Hash::merge(array('engine' => 'CakeTime'), $settings); parent::__construct($View, $settings); list($plugin, $engineClass) = pluginSplit($settings['engine'], true); App::uses($engineClass, $plugin . 'Utility');