From a38a616cba8786f851cac31d973131db046295c4 Mon Sep 17 00:00:00 2001 From: dogmatic69 Date: Sat, 15 Sep 2012 11:06:02 +0100 Subject: [PATCH] changing join() to implode() for consistency --- lib/Cake/Configure/IniReader.php | 2 +- lib/Cake/I18n/I18n.php | 8 ++++---- lib/Cake/Model/CakeSchema.php | 10 +++++----- lib/Cake/Model/Datasource/Database/Sqlite.php | 6 +++--- lib/Cake/Model/Datasource/DboSource.php | 2 +- .../Test/Case/Model/Datasource/Database/MysqlTest.php | 2 +- lib/Cake/Utility/Debugger.php | 6 +++--- lib/Cake/Utility/Inflector.php | 4 ++-- lib/Cake/View/Helper.php | 2 +- lib/Cake/View/Helper/FormHelper.php | 2 +- lib/Cake/View/Helper/HtmlHelper.php | 6 +++--- lib/Cake/View/Helper/JsBaseEngineHelper.php | 2 +- 12 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/Cake/Configure/IniReader.php b/lib/Cake/Configure/IniReader.php index 900d65489..323a9c642 100644 --- a/lib/Cake/Configure/IniReader.php +++ b/lib/Cake/Configure/IniReader.php @@ -180,7 +180,7 @@ class IniReader implements ConfigReaderInterface { } } } - $contents = join("\n", $result); + $contents = implode("\n", $result); if (substr($filename, -4) !== '.ini') { $filename .= '.ini'; diff --git a/lib/Cake/I18n/I18n.php b/lib/Cake/I18n/I18n.php index 7678ba6ae..9343d349d 100644 --- a/lib/Cake/I18n/I18n.php +++ b/lib/Cake/I18n/I18n.php @@ -592,19 +592,19 @@ class I18n { $string = $string[1]; if (substr($string, 0, 2) === $this->_escape . 'x') { $delimiter = $this->_escape . 'x'; - return join('', array_map('chr', array_map('hexdec',array_filter(explode($delimiter, $string))))); + return implode('', array_map('chr', array_map('hexdec',array_filter(explode($delimiter, $string))))); } if (substr($string, 0, 2) === $this->_escape . 'd') { $delimiter = $this->_escape . 'd'; - return join('', array_map('chr', array_filter(explode($delimiter, $string)))); + return implode('', array_map('chr', array_filter(explode($delimiter, $string)))); } if ($string[0] === $this->_escape && isset($string[1]) && is_numeric($string[1])) { $delimiter = $this->_escape; - return join('', array_map('chr', array_filter(explode($delimiter, $string)))); + return implode('', array_map('chr', array_filter(explode($delimiter, $string)))); } if (substr($string, 0, 3) === 'U00') { $delimiter = 'U00'; - return join('', array_map('chr', array_map('hexdec', array_filter(explode($delimiter, $string))))); + return implode('', array_map('chr', array_map('hexdec', array_filter(explode($delimiter, $string))))); } if (preg_match('/U([0-9a-fA-F]{4})/', $string, $match)) { return Multibyte::ascii(array(hexdec($match[1]))); diff --git a/lib/Cake/Model/CakeSchema.php b/lib/Cake/Model/CakeSchema.php index 75339e608..70430e6c2 100644 --- a/lib/Cake/Model/CakeSchema.php +++ b/lib/Cake/Model/CakeSchema.php @@ -418,26 +418,26 @@ class CakeSchema extends Object { } $col = "\t\t'{$field}' => array('type' => '" . $value['type'] . "', "; unset($value['type']); - $col .= join(', ', $this->_values($value)); + $col .= implode(', ', $this->_values($value)); } elseif ($field == 'indexes') { $col = "\t\t'indexes' => array(\n\t\t\t"; $props = array(); foreach ((array)$value as $key => $index) { - $props[] = "'{$key}' => array(" . join(', ', $this->_values($index)) . ")"; + $props[] = "'{$key}' => array(" . implode(', ', $this->_values($index)) . ")"; } - $col .= join(",\n\t\t\t", $props) . "\n\t\t"; + $col .= implode(",\n\t\t\t", $props) . "\n\t\t"; } elseif ($field == 'tableParameters') { $col = "\t\t'tableParameters' => array("; $props = array(); foreach ((array)$value as $key => $param) { $props[] = "'{$key}' => '$param'"; } - $col .= join(', ', $props); + $col .= implode(', ', $props); } $col .= ")"; $cols[] = $col; } - $out .= join(",\n", $cols); + $out .= implode(",\n", $cols); } $out .= "\n\t);\n"; return $out; diff --git a/lib/Cake/Model/Datasource/Database/Sqlite.php b/lib/Cake/Model/Datasource/Database/Sqlite.php index 0ca4bc2c3..891e2ce38 100644 --- a/lib/Cake/Model/Datasource/Database/Sqlite.php +++ b/lib/Cake/Model/Datasource/Database/Sqlite.php @@ -459,7 +459,7 @@ class Sqlite extends DboSource { $out .= 'UNIQUE '; } if (is_array($value['column'])) { - $value['column'] = join(', ', array_map(array(&$this, 'name'), $value['column'])); + $value['column'] = implode(', ', array_map(array(&$this, 'name'), $value['column'])); } else { $value['column'] = $this->name($value['column']); } @@ -524,10 +524,10 @@ class Sqlite extends DboSource { case 'schema': extract($data); if (is_array($columns)) { - $columns = "\t" . join(",\n\t", array_filter($columns)); + $columns = "\t" . implode(",\n\t", array_filter($columns)); } if (is_array($indexes)) { - $indexes = "\t" . join("\n\t", array_filter($indexes)); + $indexes = "\t" . implode("\n\t", array_filter($indexes)); } return "CREATE TABLE {$table} (\n{$columns});\n{$indexes}"; default: diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index cac97e6c0..01c0cf5ba 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -1766,7 +1766,7 @@ class DboSource extends DataSource { case 'schema': foreach (array('columns', 'indexes', 'tableParameters') as $var) { if (is_array(${$var})) { - ${$var} = "\t" . join(",\n\t", array_filter(${$var})); + ${$var} = "\t" . implode(",\n\t", array_filter(${$var})); } else { ${$var} = ''; } diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php index e60cd3aa5..4a633b417 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php @@ -3270,7 +3270,7 @@ class MysqlTest extends CakeTestCase { ); $conditions = array('comment_count >' => 2); - $query = 'SELECT ' . join(',', $this->Dbo->fields($Article, null, array('id', 'comment_count'))) . + $query = 'SELECT ' . implode(',', $this->Dbo->fields($Article, null, array('id', 'comment_count'))) . ' FROM ' . $this->Dbo->fullTableName($Article) . ' Article ' . $this->Dbo->conditions($conditions, true, true, $Article); $result = $this->Dbo->fetchAll($query); $expected = array(array( diff --git a/lib/Cake/Utility/Debugger.php b/lib/Cake/Utility/Debugger.php index 71638f334..00fa060a5 100644 --- a/lib/Cake/Utility/Debugger.php +++ b/lib/Cake/Utility/Debugger.php @@ -318,7 +318,7 @@ class Debugger { foreach ($next['args'] as $arg) { $args[] = Debugger::exportVar($arg); } - $reference .= join(', ', $args); + $reference .= implode(', ', $args); } $reference .= ')'; } @@ -779,11 +779,11 @@ class Debugger { continue; } if (is_array($value)) { - $value = join("\n", $value); + $value = implode("\n", $value); } $info .= String::insert($tpl[$key], array($key => $value) + $data, $insertOpts); } - $links = join(' ', $links); + $links = implode(' ', $links); if (isset($tpl['callback']) && is_callable($tpl['callback'])) { return call_user_func($tpl['callback'], $data, compact('links', 'info')); diff --git a/lib/Cake/Utility/Inflector.php b/lib/Cake/Utility/Inflector.php index 31829d621..f18323e5a 100644 --- a/lib/Cake/Utility/Inflector.php +++ b/lib/Cake/Utility/Inflector.php @@ -406,8 +406,8 @@ class Inflector { } if (!isset(self::$_singular['cacheUninflected']) || !isset(self::$_singular['cacheIrregular'])) { - self::$_singular['cacheUninflected'] = '(?:' . join('|', self::$_singular['merged']['uninflected']) . ')'; - self::$_singular['cacheIrregular'] = '(?:' . join('|', array_keys(self::$_singular['merged']['irregular'])) . ')'; + self::$_singular['cacheUninflected'] = '(?:' . implode('|', self::$_singular['merged']['uninflected']) . ')'; + self::$_singular['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$_singular['merged']['irregular'])) . ')'; } if (preg_match('/(.*)\\b(' . self::$_singular['cacheIrregular'] . ')$/i', $word, $regs)) { diff --git a/lib/Cake/View/Helper.php b/lib/Cake/View/Helper.php index 1f5933353..6738d2ea4 100644 --- a/lib/Cake/View/Helper.php +++ b/lib/Cake/View/Helper.php @@ -607,7 +607,7 @@ class Helper extends Object { $entity = $this->entity(); $model = array_shift($entity); - $dom = $model . join('', array_map(array('Inflector', 'camelize'), $entity)); + $dom = $model . implode('', array_map(array('Inflector', 'camelize'), $entity)); if (is_array($options) && !array_key_exists($id, $options)) { $options[$id] = $dom; diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 4ff2d9a20..5f3a03d49 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -274,7 +274,7 @@ class FormHelper extends AppHelper { if (empty($errors)) { return false; } - $errors = Hash::get($errors, join('.', $entity)); + $errors = Hash::get($errors, implode('.', $entity)); return $errors === null ? false : $errors; } diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php index 8cf545748..5582f58f6 100644 --- a/lib/Cake/View/Helper/HtmlHelper.php +++ b/lib/Cake/View/Helper/HtmlHelper.php @@ -637,7 +637,7 @@ class HtmlHelper extends AppHelper { $out[] = $key . ':' . $value . ';'; } if ($oneline) { - return join(' ', $out); + return implode(' ', $out); } return implode("\n", $out); } @@ -669,7 +669,7 @@ class HtmlHelper extends AppHelper { $out[] = $crumb[0]; } } - return join($separator, $out); + return implode($separator, $out); } else { return null; } @@ -805,7 +805,7 @@ class HtmlHelper extends AppHelper { $out[] = sprintf($this->_tags['tableheader'], $this->_parseAttributes(current($arg)), key($arg)); } } - return sprintf($this->_tags['tablerow'], $this->_parseAttributes($trOptions), join(' ', $out)); + return sprintf($this->_tags['tablerow'], $this->_parseAttributes($trOptions), implode(' ', $out)); } /** diff --git a/lib/Cake/View/Helper/JsBaseEngineHelper.php b/lib/Cake/View/Helper/JsBaseEngineHelper.php index b3a293ac4..bd83c387d 100644 --- a/lib/Cake/View/Helper/JsBaseEngineHelper.php +++ b/lib/Cake/View/Helper/JsBaseEngineHelper.php @@ -494,7 +494,7 @@ abstract class JsBaseEngineHelper extends AppHelper { $out[] = $key . ':' . $value; } sort($out); - return join(', ', $out); + return implode(', ', $out); } /**