changing join() to implode() for consistency

This commit is contained in:
dogmatic69 2012-09-15 11:06:02 +01:00
parent ccd33782da
commit a38a616cba
12 changed files with 26 additions and 26 deletions

View file

@ -180,7 +180,7 @@ class IniReader implements ConfigReaderInterface {
}
}
}
$contents = join("\n", $result);
$contents = implode("\n", $result);
if (substr($filename, -4) !== '.ini') {
$filename .= '.ini';

View file

@ -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])));

View file

@ -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;

View file

@ -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:

View file

@ -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} = '';
}

View file

@ -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(

View file

@ -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'));

View file

@ -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)) {

View file

@ -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;

View file

@ -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;
}

View file

@ -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));
}
/**

View file

@ -494,7 +494,7 @@ abstract class JsBaseEngineHelper extends AppHelper {
$out[] = $key . ':' . $value;
}
sort($out);
return join(', ', $out);
return implode(', ', $out);
}
/**