Skip to content
Permalink
Browse files

Unify and clean string based merges.

Correct doc blocks.
  • Loading branch information...
dereuromark committed Sep 5, 2014
1 parent b35cc28 commit 49ca2b29e1f7e7c36cbe0a1de3f99d8d79c6af4a
@@ -82,8 +82,8 @@ public function getUser(Request $request) {
/**
* Handles an unauthenticated access attempt by sending appropriate login headers
*
* @param Request $request A request object.
* @param Response $response A response object.
* @param \Cake\Network\Request $request A request object.
* @param \Cake\Network\Response $response A response object.
* @return void
* @throws \Cake\Network\Exception\UnauthorizedException
*/
@@ -73,26 +73,26 @@ public function __construct(ComponentRegistry $collection, array $config = []) {
* @return void
*/
public function set($message, array $options = []) {
$opts = array_merge($this->config(), $options);
$options += $this->config();
if ($message instanceof \Exception) {
$opts['params'] += ['code' => $message->getCode()];
$options['params'] += ['code' => $message->getCode()];
$message = $message->getMessage();
}
list($plugin, $element) = pluginSplit($opts['element']);
list($plugin, $element) = pluginSplit($options['element']);
if ($plugin) {
$opts['element'] = $plugin . '.Flash/' . $element;
$options['element'] = $plugin . '.Flash/' . $element;
} else {
$opts['element'] = 'Flash/' . $element;
$options['element'] = 'Flash/' . $element;
}
$this->_session->write('Flash.' . $opts['key'], [
$this->_session->write('Flash.' . $options['key'], [
'message' => $message,
'key' => $opts['key'],
'element' => $opts['element'],
'params' => $opts['params']
'key' => $options['key'],
'element' => $options['element'],
'params' => $options['params']
]);
}
@@ -300,11 +300,11 @@ public static function trace(array $options = array()) {
);
for ($i = $options['start']; $i < $count && $i < $options['depth']; $i++) {
$trace = array_merge(array('file' => '[internal]', 'line' => '??'), $backtrace[$i]);
$trace = $backtrace[$i] + array('file' => '[internal]', 'line' => '??');
$signature = $reference = '[main]';
if (isset($backtrace[$i + 1])) {
$next = array_merge($_trace, $backtrace[$i + 1]);
$next = $backtrace[$i + 1] + $_trace;
$signature = $reference = $next['function'];
if (!empty($next['class'])) {
@@ -689,7 +689,7 @@ public static function addFormat($format, array $strings) {
);
unset($strings['links']);
}
$self->_templates[$format] = array_merge($self->_templates[$format], $strings);
$self->_templates[$format] = $strings + $self->_templates[$format];
} else {
$self->_templates[$format] = $strings;
}
@@ -779,7 +779,7 @@ public function outputError($data) {
$data['trace'] = $trace;
$data['id'] = 'cakeErr' . uniqid();
$tpl = array_merge($this->_templates['base'], $this->_templates[$this->_outputFormat]);
$tpl = $this->_templates[$this->_outputFormat] + $this->_templates['base'];
if (isset($tpl['links'])) {
foreach ($tpl['links'] as $key => $val) {
@@ -425,7 +425,7 @@ protected function _typeHeaders($type) {
* Uses the authentication type to choose the correct strategy
* and use its methods to add headers.
*
* @param Request $request The request to modify.
* @param \Cake\Network\Http\Request $request The request to modify.
* @param array $options Array of options containing the 'auth' key.
* @return void
*/
@@ -441,7 +441,7 @@ protected function _addAuthentication(Request $request, $options) {
* Uses the authentication type to choose the correct strategy
* and use its methods to add headers.
*
* @param Request $request The request to modify.
* @param \Cake\Network\Http\Request $request The request to modify.
* @param array $options Array of options containing the 'proxy' key.
* @return void
*/
@@ -343,10 +343,7 @@ public function next($title = 'Next >>', array $options = []) {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html#PaginatorHelper::sort
*/
public function sort($key, $title = null, array $options = []) {
$options = array_merge(
['url' => array(), 'model' => null, 'escape' => true],
$options
);
$options += ['url' => array(), 'model' => null, 'escape' => true];
$url = $options['url'];
unset($options['url']);
@@ -519,6 +516,7 @@ public function defaultModel() {
* custom content you would like.
*
* @param string|array $options Options for the counter string. See #options for list of keys.
* If string it will be used as format.
* @return string Counter string.
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html#PaginatorHelper::counter
*/
@@ -527,12 +525,10 @@ public function counter($options = []) {
$options = array('format' => $options);
}
$options = array_merge(
[
'model' => $this->defaultModel(),
'format' => 'pages',
],
$options);
$options += [
'model' => $this->defaultModel(),
'format' => 'pages',
];
$paging = $this->params($options['model']);
if (!$paging['pageCount']) {
@@ -737,10 +733,7 @@ public function numbers(array $options = array()) {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html#PaginatorHelper::first
*/
public function first($first = '<< first', array $options = []) {
$options = array_merge(
['model' => $this->defaultModel(), 'escape' => true],
$options
);
$options += ['model' => $this->defaultModel(), 'escape' => true];
$params = $this->params($options['model']);
@@ -789,11 +782,7 @@ public function first($first = '<< first', array $options = []) {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html#PaginatorHelper::last
*/
public function last($last = 'last >>', array $options = array()) {
$options = array_merge(
['model' => $this->defaultModel(), 'escape' => true],
$options
);
$options += ['model' => $this->defaultModel(), 'escape' => true];
$params = $this->params($options['model']);
if ($params['pageCount'] <= 1) {
@@ -220,7 +220,7 @@ public function autoLinkEmails($text, array $options = array()) {
*/
public function autoLink($text, array $options = array()) {
$text = $this->autoLinkUrls($text, $options);
return $this->autoLinkEmails($text, array_merge($options, array('escape' => false)));
return $this->autoLinkEmails($text, array('escape' => false) + $options);
}
/**

0 comments on commit 49ca2b2

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