Skip to content

Commit

Permalink
Merge branch '2.5' of github.com:cakephp/cakephp into 2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Apr 8, 2014
2 parents ac66c2c + bb7b450 commit debdc6b
Show file tree
Hide file tree
Showing 38 changed files with 128 additions and 140 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Cache/Cache.php
Expand Up @@ -130,7 +130,7 @@ public static function config($name = null, $settings = array()) {
}

if (!empty($settings)) {
self::$_config[$name] = array_merge($current, $settings);
self::$_config[$name] = $settings + $current;
}

if (empty(self::$_config[$name]['engine'])) {
Expand Down Expand Up @@ -253,7 +253,7 @@ public static function set($settings = array(), $value = null, $config = 'defaul
if (is_string($settings) && $value !== null) {
$settings = array($settings => $value);
}
$settings = array_merge(self::$_config[$config], $settings);
$settings += self::$_config[$config];
if (isset($settings['duration']) && !is_numeric($settings['duration'])) {
$settings['duration'] = strtotime($settings['duration']) - time();
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/Console/Command/Task/DbConfigTask.php
Expand Up @@ -203,7 +203,7 @@ protected function _interactive() {
* @return boolean True if user says it looks good, false otherwise
*/
protected function _verify($config) {
$config = array_merge($this->_defaultConfig, $config);
$config += $this->_defaultConfig;
extract($config);
$this->out();
$this->hr();
Expand Down Expand Up @@ -264,7 +264,7 @@ public function bake($configs) {
$temp = get_class_vars(get_class($db));

foreach ($temp as $configName => $info) {
$info = array_merge($this->_defaultConfig, $info);
$info += $this->_defaultConfig;

if (!isset($info['schema'])) {
$info['schema'] = null;
Expand Down Expand Up @@ -307,7 +307,7 @@ public function bake($configs) {
$out .= "class DATABASE_CONFIG {\n\n";

foreach ($configs as $config) {
$config = array_merge($this->_defaultConfig, $config);
$config += $this->_defaultConfig;
extract($config);

if (strpos($datasource, 'Database/') === false) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/Command/UpgradeShell.php
Expand Up @@ -199,7 +199,7 @@ public function locations() {
$dir = $options;
$options = array();
}
$options = array_merge($defaultOptions, $options);
$options += $defaultOptions;
$this->_movePhpFiles($dir, $options);
}
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/Console/ConsoleOptionParser.php
Expand Up @@ -299,7 +299,7 @@ public function addOption($name, $options = array()) {
'boolean' => false,
'choices' => array()
);
$options = array_merge($defaults, $options);
$options += $defaults;
$option = new ConsoleInputOption($options);
}
$this->_options[$name] = $option;
Expand Down Expand Up @@ -338,7 +338,7 @@ public function addArgument($name, $params = array()) {
'required' => false,
'choices' => array()
);
$options = array_merge($defaults, $params);
$options = $params + $defaults;
$index = $options['index'];
unset($options['index']);
$arg = new ConsoleInputArgument($options);
Expand Down Expand Up @@ -403,7 +403,7 @@ public function addSubcommand($name, $options = array()) {
'help' => '',
'parser' => null
);
$options = array_merge($defaults, $options);
$options += $defaults;
$command = new ConsoleInputSubcommand($options);
}
$this->_subcommands[$name] = $command;
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/ShellDispatcher.php
Expand Up @@ -311,7 +311,7 @@ public function parseParams($args) {
$params = str_replace('/', '\\', $params);
}

$this->params = array_merge($this->params, $params);
$this->params = $params + $this->params;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Controller/Component.php
Expand Up @@ -92,7 +92,7 @@ public function __construct(ComponentCollection $collection, $settings = array()
*/
public function __get($name) {
if (isset($this->_componentMap[$name]) && !isset($this->{$name})) {
$settings = array_merge((array)$this->_componentMap[$name]['settings'], array('enabled' => false));
$settings = array('enabled' => false) + (array)$this->_componentMap[$name]['settings'];
$this->{$name} = $this->_Collection->load($this->_componentMap[$name]['class'], $settings);
}
if (isset($this->{$name})) {
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Controller/Component/Acl/PhpAcl.php
Expand Up @@ -81,7 +81,7 @@ public function __construct() {
*/
public function initialize(Component $Component) {
if (!empty($Component->settings['adapter'])) {
$this->options = array_merge($this->options, $Component->settings['adapter']);
$this->options = $Component->settings['adapter'] + $this->options;
}

App::uses('PhpReader', 'Configure');
Expand Down Expand Up @@ -546,7 +546,7 @@ public function addRole(array $aro) {
* @return void
*/
public function addAlias(array $alias) {
$this->aliases = array_merge($this->aliases, $alias);
$this->aliases = $alias + $this->aliases;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Controller/Component/RequestHandlerComponent.php
Expand Up @@ -603,7 +603,7 @@ public function renderAs(Controller $controller, $type, $options = array()) {
if (Configure::read('App.encoding') !== null) {
$defaults['charset'] = Configure::read('App.encoding');
}
$options = array_merge($defaults, $options);
$options += $defaults;

if ($type === 'ajax') {
$controller->layout = $this->ajaxLayout;
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Core/Object.php
Expand Up @@ -84,7 +84,7 @@ public function requestAction($url, $extra = array()) {
if ($arrayUrl && !isset($extra['data'])) {
$extra['data'] = array();
}
$extra = array_merge(array('autoRender' => 0, 'return' => 1, 'bare' => 1, 'requested' => 1), $extra);
$extra += array('autoRender' => 0, 'return' => 1, 'bare' => 1, 'requested' => 1);
$data = isset($extra['data']) ? $extra['data'] : null;
unset($extra['data']);

Expand All @@ -95,7 +95,7 @@ public function requestAction($url, $extra = array()) {
$request = new CakeRequest($url);
} elseif (is_array($url)) {
$params = $url + array('pass' => array(), 'named' => array(), 'base' => false);
$params = array_merge($params, $extra);
$params = $extra + $params;
$request = new CakeRequest(Router::reverse($params));
}
if (isset($data)) {
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Model/Behavior/TreeBehavior.php
Expand Up @@ -67,7 +67,7 @@ public function setup(Model $Model, $config = array()) {
$config['type'] = $config[0];
unset($config[0]);
}
$settings = array_merge($this->_defaults, $config);
$settings = $config + $this->_defaults;

if (in_array($settings['scope'], $Model->getAssociated('belongsTo'))) {
$data = $Model->getAssociated($settings['scope']);
Expand Down Expand Up @@ -743,7 +743,7 @@ protected function _recoverByParentId(Model $Model, $counter = 1, $parentId = nu
* @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html#TreeBehavior::reorder
*/
public function reorder(Model $Model, $options = array()) {
$options = array_merge(array('id' => null, 'field' => $Model->displayField, 'order' => 'ASC', 'verify' => true), $options);
$options += array('id' => null, 'field' => $Model->displayField, 'order' => 'ASC', 'verify' => true);
extract($options);
if ($verify && !$this->verify($Model)) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/Datasource/Database/Sqlite.php
Expand Up @@ -395,7 +395,7 @@ public function limit($limit, $offset = null) {
*/
public function buildColumn($column) {
$name = $type = null;
$column = array_merge(array('null' => true), $column);
$column += array('null' => true);
extract($column);

if (empty($name) || empty($type)) {
Expand Down
20 changes: 10 additions & 10 deletions lib/Cake/Model/Model.php
Expand Up @@ -1663,7 +1663,7 @@ public function saveField($name, $value, $validate = false) {

$options = array('validate' => $validate, 'fieldList' => array($name));
if (is_array($validate)) {
$options = array_merge(array('validate' => false, 'fieldList' => array($name)), $validate);
$options = $validate + array('validate' => false, 'fieldList' => array($name));
}

return $this->save(array($this->alias => array($this->primaryKey => $id, $name => $value)), $options);
Expand Down Expand Up @@ -1697,9 +1697,9 @@ public function save($data = null, $validate = true, $fieldList = array()) {
$fields = array();

if (!is_array($validate)) {
$options = array_merge($defaults, compact('validate', 'fieldList'));
$options = compact('validate', 'fieldList') + $defaults;
} else {
$options = array_merge($defaults, $validate);
$options = $validate + $defaults;
}

if (!empty($options['fieldList'])) {
Expand Down Expand Up @@ -2164,7 +2164,7 @@ protected function _prepareUpdateFields($data) {
* @link http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-saveall-array-data-null-array-options-array
*/
public function saveAll($data = array(), $options = array()) {
$options = array_merge(array('validate' => 'first'), $options);
$options += array('validate' => 'first');
if (Hash::numeric(array_keys($data))) {
if ($options['validate'] === 'only') {
return $this->validateMany($data, $options);
Expand Down Expand Up @@ -2206,7 +2206,7 @@ public function saveMany($data = null, $options = array()) {
$data = $this->data;
}

$options = array_merge(array('validate' => 'first', 'atomic' => true, 'deep' => false), $options);
$options += array('validate' => 'first', 'atomic' => true, 'deep' => false);
$this->validationErrors = $validationErrors = array();

if (empty($data) && $options['validate'] !== false) {
Expand Down Expand Up @@ -2328,7 +2328,7 @@ public function saveAssociated($data = null, $options = array()) {
$data = $this->data;
}

$options = array_merge(array('validate' => 'first', 'atomic' => true, 'deep' => false), $options);
$options += array('validate' => 'first', 'atomic' => true, 'deep' => false);
$this->validationErrors = $validationErrors = array();

if (empty($data) && $options['validate'] !== false) {
Expand Down Expand Up @@ -2369,9 +2369,9 @@ public function saveAssociated($data = null, $options = array()) {
$saved = false;
if ($validates) {
if ($options['deep']) {
$saved = $Model->saveAssociated($values, array_merge($options, array('atomic' => false)));
$saved = $Model->saveAssociated($values, array('atomic' => false) + $options);
} else {
$saved = $Model->save($values, array_merge($options, array('atomic' => false)));
$saved = $Model->save($values, array('atomic' => false) + $options);
}
$validates = ($saved === true || (is_array($saved) && !in_array(false, $saved, true)));
}
Expand Down Expand Up @@ -2425,7 +2425,7 @@ public function saveAssociated($data = null, $options = array()) {
if ($validates) {
$options = $Model->_addToWhiteList($key, $options);
if ($options['deep']) {
$saved = $Model->saveAssociated($values, array_merge($options, array('atomic' => false)));
$saved = $Model->saveAssociated($values, array('atomic' => false) + $options);
} else {
$saved = $Model->save($values, $options);
}
Expand All @@ -2448,7 +2448,7 @@ public function saveAssociated($data = null, $options = array()) {
}

$options = $Model->_addToWhiteList($key, $options);
$_return = $Model->saveMany($values, array_merge($options, array('atomic' => false)));
$_return = $Model->saveMany($values, array('atomic' => false) + $options);
if (in_array(false, $_return, true)) {
$validationErrors[$association] = $Model->validationErrors;
$validates = false;
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Model/ModelValidator.php
Expand Up @@ -127,7 +127,7 @@ public function validates($options = array()) {
*/
public function validateAssociated(&$data, $options = array()) {
$model = $this->getModel();
$options = array_merge(array('atomic' => true, 'deep' => false), $options);
$options += array('atomic' => true, 'deep' => false);
$model->validationErrors = $validationErrors = $return = array();
$model->create(null);
$return[$model->alias] = true;
Expand Down Expand Up @@ -204,7 +204,7 @@ public function validateAssociated(&$data, $options = array()) {
*/
public function validateMany(&$data, $options = array()) {
$model = $this->getModel();
$options = array_merge(array('atomic' => true, 'deep' => false), $options);
$options += array('atomic' => true, 'deep' => false);
$model->validationErrors = $validationErrors = $return = array();
foreach ($data as $key => &$record) {
if ($options['deep']) {
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Network/Email/CakeEmail.php
Expand Up @@ -1135,7 +1135,7 @@ public function send($content = null) {
if (!is_array($this->_config['log'])) {
$this->_config['log'] = array('level' => $this->_config['log']);
}
$config = array_merge($config, $this->_config['log']);
$config = $this->_config['log'] + $config;
}
CakeLog::write(
$config['level'],
Expand Down Expand Up @@ -1199,7 +1199,7 @@ protected function _applyConfig($config) {
}
$config = $configs->{$config};
}
$this->_config = array_merge($this->_config, $config);
$this->_config = $config + $this->_config;
if (!empty($config['charset'])) {
$this->charset = $config['charset'];
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Network/Http/HttpSocket.php
Expand Up @@ -893,7 +893,7 @@ protected function _buildRequestLine($request = array(), $versionToken = 'HTTP/1
}

$request['uri'] = $this->_parseUri($request['uri']);
$request = array_merge(array('method' => 'GET'), $request);
$request += array('method' => 'GET');
if (!empty($this->_proxy['host'])) {
$request['uri'] = $this->_buildUri($request['uri'], '%scheme://%host:%port/%path?%query');
} else {
Expand Down
8 changes: 4 additions & 4 deletions lib/Cake/Routing/Router.php
Expand Up @@ -480,10 +480,10 @@ public static function connectNamed($named, $options = array()) {
}

if ($named === true || $named === false) {
$options = array_merge(array('default' => $named, 'reset' => true, 'greedy' => $named), $options);
$options += array('default' => $named, 'reset' => true, 'greedy' => $named);
$named = array();
} else {
$options = array_merge(array('default' => false, 'reset' => false, 'greedy' => true), $options);
$options += array('default' => false, 'reset' => false, 'greedy' => true);
}

if ($options['reset'] || self::$_namedConfig['rules'] === false) {
Expand Down Expand Up @@ -532,11 +532,11 @@ public static function namedConfig() {
*/
public static function mapResources($controller, $options = array()) {
$hasPrefix = isset($options['prefix']);
$options = array_merge(array(
$options += array(
'connectOptions' => array(),
'prefix' => '/',
'id' => self::ID . '|' . self::UUID
), $options);
);

$prefix = $options['prefix'];
$connectOptions = $options['connectOptions'];
Expand Down
10 changes: 5 additions & 5 deletions lib/Cake/Test/Case/Model/models.php
Expand Up @@ -172,7 +172,7 @@ class TestValidate extends CakeTestModel {
* @return void
*/
public function validateNumber($value, $options) {
$options = array_merge(array('min' => 0, 'max' => 100), $options);
$options += array('min' => 0, 'max' => 100);
$valid = ($value['number'] >= $options['min'] && $value['number'] <= $options['max']);
return $valid;
}
Expand Down Expand Up @@ -1511,8 +1511,8 @@ class SomethingElse extends CakeTestModel {

/**
* afterFind callBack
*
* @param array $results
*
* @param array $results
* @param bool $primary
* @return array
*/
Expand Down Expand Up @@ -1550,8 +1550,8 @@ class JoinThing extends CakeTestModel {

/**
* afterFind callBack
*
* @param array $results
*
* @param array $results
* @param bool $primary
* @return array
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/TestSuite/ControllerTestCase.php
Expand Up @@ -215,11 +215,11 @@ public function __call($name, $arguments) {
protected function _testAction($url = '', $options = array()) {
$this->vars = $this->result = $this->view = $this->contents = $this->headers = null;

$options = array_merge(array(
$options += array(
'data' => array(),
'method' => 'POST',
'return' => 'result'
), $options);
);

$restore = array('get' => $_GET, 'post' => $_POST);

Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/Utility/CakeNumber.php
Expand Up @@ -323,18 +323,18 @@ protected static function _numberFormat($value, $places = 0, $decimals = '.', $t
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::currency
*/
public static function currency($value, $currency = null, $options = array()) {
$default = self::$_currencyDefaults;
$defaults = self::$_currencyDefaults;
if ($currency === null) {
$currency = self::defaultCurrency();
}

if (isset(self::$_currencies[$currency])) {
$default = self::$_currencies[$currency];
$defaults = self::$_currencies[$currency];
} elseif (is_string($currency)) {
$options['before'] = $currency;
}

$options = array_merge($default, $options);
$options += $defaults;

if (isset($options['before']) && $options['before'] !== '') {
$options['wholeSymbol'] = $options['before'];
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Utility/ClassRegistry.php
Expand Up @@ -119,7 +119,7 @@ public static function init($class, $strict = false) {

if (is_array($settings)) {
$pluginPath = null;
$settings = array_merge($defaults, $settings);
$settings += $defaults;
$class = $settings['class'];

list($plugin, $class) = pluginSplit($class);
Expand Down

0 comments on commit debdc6b

Please sign in to comment.