Replace function join (alias) by implode.

Signed-off-by: Mark Story <mark@mark-story.com>
This commit is contained in:
Juan Basso 2009-11-19 20:13:35 -02:00 committed by mark_story
parent 1acc60b04c
commit df9e1e0bd1
33 changed files with 111 additions and 111 deletions

View file

@ -423,7 +423,7 @@ if (!function_exists('file_put_contents')) {
/**
* Writes data into file.
*
* If file exists, it will be overwritten. If data is an array, it will be join()ed with an empty string.
* If file exists, it will be overwritten. If data is an array, it will be implode()ed with an empty string.
*
* @param string $fileName File name.
* @param mixed $data String or array.
@ -431,7 +431,7 @@ if (!function_exists('file_put_contents')) {
*/
function file_put_contents($fileName, $data) {
if (is_array($data)) {
$data = join('', $data);
$data = implode('', $data);
}
$res = @fopen($fileName, 'w+b');

View file

@ -286,7 +286,7 @@ class ConsoleShell extends Shell {
break;
case (preg_match("/^routes\s+show/i", $command, $tmp) == true):
$router =& Router::getInstance();
$this->out(join("\n", Set::extract($router->routes, '{n}.0')));
$this->out(implode("\n", Set::extract($router->routes, '{n}.0')));
break;
case (preg_match("/^route\s+(.*)/i", $command, $tmp) == true):
$this->out(var_export(Router::parse($tmp[1]), true));

View file

@ -126,7 +126,7 @@ class ControllerTask extends Shell {
if (file_exists($this->path . $controllerFile .'_controller.php')) {
$question[] = sprintf(__("Warning: Choosing no will overwrite the %sController.", true), $controllerName);
}
$doItInteractive = $this->in(join("\n", $question), array('y','n'), 'y');
$doItInteractive = $this->in(implode("\n", $question), array('y','n'), 'y');
if (strtolower($doItInteractive) == 'y' || strtolower($doItInteractive) == 'yes') {
$this->interactive = true;
@ -313,7 +313,7 @@ class ControllerTask extends Shell {
}
}
if (!empty($compact)) {
$actions .= "\t\t\$this->set(compact(" . join(', ', $compact) . "));\n";
$actions .= "\t\t\$this->set(compact(" . implode(', ', $compact) . "));\n";
}
$actions .= "\t}\n";
$actions .= "\n";
@ -365,7 +365,7 @@ class ControllerTask extends Shell {
}
}
if (!empty($compact)) {
$actions .= "\t\t\$this->set(compact(" . join(',', $compact) . "));\n";
$actions .= "\t\t\$this->set(compact(" . implode(',', $compact) . "));\n";
}
$actions .= "\t}\n";
$actions .= "\n";

View file

@ -414,13 +414,13 @@ class ExtractTask extends Shell{
if ($this->__oneFile === true) {
foreach ($fileInfo as $file => $lines) {
$occured[] = "$file:" . join(';', $lines);
$occured[] = "$file:" . implode(';', $lines);
if (isset($this->__fileVersions[$file])) {
$fileList[] = $this->__fileVersions[$file];
}
}
$occurances = join("\n#: ", $occured);
$occurances = implode("\n#: ", $occured);
$occurances = str_replace($this->path, '', $occurances);
$output = "#: $occurances\n";
$filename = $this->__filename;
@ -439,12 +439,12 @@ class ExtractTask extends Shell{
} else {
foreach ($fileInfo as $file => $lines) {
$filename = $str;
$occured = array("$str:" . join(';', $lines));
$occured = array("$str:" . implode(';', $lines));
if (isset($this->__fileVersions[$str])) {
$fileList[] = $this->__fileVersions[$str];
}
$occurances = join("\n#: ", $occured);
$occurances = implode("\n#: ", $occured);
$occurances = str_replace($this->path, '', $occurances);
$output .= "#: $occurances\n";
@ -511,9 +511,9 @@ class ExtractTask extends Shell{
$fileList = str_replace(array($this->path), '', $fileList);
if (count($fileList) > 1) {
$fileList = "Generated from files:\n# " . join("\n# ", $fileList);
$fileList = "Generated from files:\n# " . implode("\n# ", $fileList);
} elseif (count($fileList) == 1) {
$fileList = 'Generated from file: ' . join('', $fileList);
$fileList = 'Generated from file: ' . implode('', $fileList);
} else {
$fileList = 'No version information was available in the source files.';
}
@ -535,7 +535,7 @@ class ExtractTask extends Shell{
}
}
$fp = fopen($this->__output . $file, 'w');
fwrite($fp, str_replace('--VERSIONS--', $fileList, join('', $content)));
fwrite($fp, str_replace('--VERSIONS--', $fileList, implode('', $content)));
fclose($fp);
}
}

View file

@ -700,7 +700,7 @@ class ModelTask extends Shell {
}
}
}
$fixture = join(", ", $fixture);
$fixture = implode(", ", $fixture);
$import = $className;
if (isset($this->plugin)) {
@ -904,24 +904,24 @@ class ModelTask extends Shell {
}
$records[] = "\t\t'$field' => $insert";
unset($value['type']);
$col .= join(', ', $schema->__values($value));
$col .= implode(', ', $schema->__values($value));
} else {
$col = "\t\t'indexes' => array(";
$props = array();
foreach ((array)$value as $key => $index) {
$props[] = "'{$key}' => array(" . join(', ', $schema->__values($index)) . ")";
$props[] = "'{$key}' => array(" . implode(', ', $schema->__values($index)) . ")";
}
$col .= join(', ', $props);
$col .= implode(', ', $props);
}
$col .= ")";
$cols[] = $col;
}
$out .= join(",\n", $cols);
$out .= implode(",\n", $cols);
}
$out .= "\n\t);\n";
}
}
$records = join(",\n", $records);
$records = implode(",\n", $records);
$out .= "\tvar \$records = array(array(\n$records\n\t));\n";
$out .= "}\n";
$path = TESTS . DS . 'fixtures' . DS;

View file

@ -79,7 +79,7 @@ class PagesController extends AppController {
$title = Inflector::humanize($path[$count - 1]);
}
$this->set(compact('page', 'subpage', 'title'));
$this->render(join('/', $path));
$this->render(implode('/', $path));
}
}

View file

@ -327,7 +327,7 @@ class SecurityComponent extends Object {
$out[] = 'opaque="' . md5($options['realm']).'"';
}
return $auth . ' ' . join(',', $out);
return $auth . ' ' . implode(',', $out);
}
/**
* Parses an HTTP digest authentication response, and returns an array of the data, or null on failure.

View file

@ -79,7 +79,7 @@ class PagesController extends AppController {
$title = Inflector::humanize($path[$count - 1]);
}
$this->set(compact('page', 'subpage', 'title'));
$this->render(join('/', $path));
$this->render(implode('/', $path));
}
}

View file

@ -275,7 +275,7 @@ class Debugger extends Object {
foreach ($next['args'] as $arg) {
$args[] = Debugger::exportVar($arg);
}
$function .= join(', ', $args);
$function .= implode(', ', $args);
}
$function .= ')';
}
@ -297,7 +297,7 @@ class Debugger extends Object {
if ($options['format'] == 'array' || $options['format'] == 'points') {
return $back;
}
return join("\n", $back);
return implode("\n", $back);
}
/**
* Shortens file paths by replacing the application base path with 'APP', and the CakePHP core
@ -406,7 +406,7 @@ class Debugger extends Object {
if (count($vars) > 0) {
$n = "\n";
}
return $out . join(",", $vars) . "{$n})";
return $out . implode(",", $vars) . "{$n})";
break;
case 'resource':
return strtolower(gettype($var));
@ -444,7 +444,7 @@ class Debugger extends Object {
$out[] = "$className::$$key = " . $value;
}
}
return join("\n", $out);
return implode("\n", $out);
}
/**
* Handles object conversion to debug string.

View file

@ -217,7 +217,7 @@ class Flay extends Object{
if (count($snips) > $max_snippets) {
$snips = array_slice($snips, 0, $max_snippets);
}
$joined = join(' <b>...</b> ', $snips);
$joined = implode(' <b>...</b> ', $snips);
$snips = $joined ? "<b>...</b> {$joined} <b>...</b>" : substr($string, 0, 80) . '<b>...</b>';
return $this->colorMark($words, $snips);
}

View file

@ -738,7 +738,7 @@ class HttpSocket extends CakeSocket {
$request['uri'] = $this->buildUri($request['uri'], '/%path?%query');
if (!$this->quirksMode && $request['uri'] === '*' && !in_array($request['method'], $asteriskMethods)) {
trigger_error(sprintf(__('HttpSocket::buildRequestLine - The "*" asterisk character is only allowed for the following methods: %s. Activate quirks mode to work outside of HTTP/1.1 specs.', true), join(',', $asteriskMethods)), E_USER_WARNING);
trigger_error(sprintf(__('HttpSocket::buildRequestLine - The "*" asterisk character is only allowed for the following methods: %s. Activate quirks mode to work outside of HTTP/1.1 specs.', true), implode(',', $asteriskMethods)), E_USER_WARNING);
return false;
}
return $request['method'].' '.$request['uri'].' '.$versionToken.$this->lineBreak;
@ -776,7 +776,7 @@ class HttpSocket extends CakeSocket {
$returnHeader = '';
foreach ($header as $field => $contents) {
if (is_array($contents) && $mode == 'standard') {
$contents = join(',', $contents);
$contents = implode(',', $contents);
}
foreach ((array)$contents as $content) {
$contents = preg_replace("/\r\n(?![\t ])/", "\r\n ", $content);
@ -921,7 +921,7 @@ class HttpSocket extends CakeSocket {
* @todo Test $chars parameter
*/
function unescapeToken($token, $chars = null) {
$regex = '/"(['.join('', $this->__tokenEscapeChars(true, $chars)).'])"/';
$regex = '/"(['.implode('', $this->__tokenEscapeChars(true, $chars)).'])"/';
$token = preg_replace($regex, '\\1', $token);
return $token;
}
@ -934,7 +934,7 @@ class HttpSocket extends CakeSocket {
* @todo Test $chars parameter
*/
function escapeToken($token, $chars = null) {
$regex = '/(['.join('', $this->__tokenEscapeChars(true, $chars)).'])/';
$regex = '/(['.implode('', $this->__tokenEscapeChars(true, $chars)).'])/';
$token = preg_replace($regex, '"\\1"', $token);
return $token;
}

View file

@ -243,8 +243,8 @@ class Inflector extends Object {
extract($_this->pluralRules);
if (!isset($regexUninflected) || !isset($regexIrregular)) {
$regexUninflected = __enclose(join( '|', $uninflected));
$regexIrregular = __enclose(join( '|', array_keys($irregular)));
$regexUninflected = __enclose(implode( '|', $uninflected));
$regexIrregular = __enclose(implode( '|', array_keys($irregular)));
$_this->pluralRules['regexUninflected'] = $regexUninflected;
$_this->pluralRules['regexIrregular'] = $regexIrregular;
}
@ -383,8 +383,8 @@ class Inflector extends Object {
extract($_this->singularRules);
if (!isset($regexUninflected) || !isset($regexIrregular)) {
$regexUninflected = __enclose(join( '|', $uninflected));
$regexIrregular = __enclose(join( '|', array_keys($irregular)));
$regexUninflected = __enclose(implode( '|', $uninflected));
$regexIrregular = __enclose(implode( '|', array_keys($irregular)));
$_this->singularRules['regexUninflected'] = $regexUninflected;
$_this->singularRules['regexIrregular'] = $regexIrregular;
}

View file

@ -283,7 +283,7 @@ class ContainableBehavior extends ModelBehavior {
if (strpos($name, '.') !== false) {
$chain = explode('.', $name);
$name = array_shift($chain);
$children = array(join('.', $chain) => $children);
$children = array(implode('.', $chain) => $children);
}
$children = (array)$children;

View file

@ -591,7 +591,7 @@ class DboMssql extends DboSource {
foreach (array('columns', 'indexes') as $var) {
if (is_array(${$var})) {
${$var} = "\t" . join(",\n\t", array_filter(${$var}));
${$var} = "\t" . implode(",\n\t", array_filter(${$var}));
}
}
return "CREATE TABLE {$table} (\n{$columns});\n{$indexes}";
@ -719,7 +719,7 @@ class DboMssql extends DboSource {
$out = "ALTER TABLE {$table} ADD CONSTRAINT {$name} 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']);
}

View file

@ -141,7 +141,7 @@ class DboMysqlBase extends DboSource {
$alias = $joins = false;
$fields = $this->_prepareUpdateFields($model, $combined, empty($conditions), !empty($conditions));
$fields = join(', ', $fields);
$fields = implode(', ', $fields);
$table = $this->fullTableName($model);
if (!empty($conditions)) {
@ -281,7 +281,7 @@ class DboMysqlBase extends DboSource {
}
}
$colList = array_merge($colList, $this->_alterIndexes($curTable, $indexes));
$out .= "\t" . join(",\n\t", $colList) . ";\n\n";
$out .= "\t" . implode(",\n\t", $colList) . ";\n\n";
}
}
return $out;
@ -339,7 +339,7 @@ class DboMysqlBase extends DboSource {
}
}
if (is_array($value['column'])) {
$out .= 'KEY '. $name .' (' . join(', ', array_map(array(&$this, 'name'), $value['column'])) . ')';
$out .= 'KEY '. $name .' (' . implode(', ', array_map(array(&$this, 'name'), $value['column'])) . ')';
} else {
$out .= 'KEY '. $name .' (' . $this->name($value['column']) . ')';
}
@ -358,7 +358,7 @@ class DboMysqlBase extends DboSource {
function insertMulti($table, $fields, $values) {
$table = $this->fullTableName($table);
if (is_array($fields)) {
$fields = join(', ', array_map(array(&$this, 'name'), $fields));
$fields = implode(', ', array_map(array(&$this, 'name'), $fields));
}
$values = implode(', ', $values);
$this->query("INSERT INTO {$table} ({$fields}) VALUES {$values}");

View file

@ -704,7 +704,7 @@ class DboOracle extends DboSource {
break;
}
}
$out .= "\t" . join(",\n\t", $colList) . ";\n\n";
$out .= "\t" . implode(",\n\t", $colList) . ";\n\n";
}
}
return $out;
@ -925,7 +925,7 @@ class DboOracle extends DboSource {
case 'schema':
foreach (array('columns', 'indexes') as $var) {
if (is_array(${$var})) {
${$var} = "\t" . join(",\n\t", array_filter(${$var}));
${$var} = "\t" . implode(",\n\t", array_filter(${$var}));
}
}
if (trim($indexes) != '') {
@ -977,7 +977,7 @@ class DboOracle extends DboSource {
$fetch = array();
$ins = array_chunk($ins, 1000);
foreach ($ins as $i) {
$q = str_replace('{$__cakeID__$}', join(', ', $i), $query);
$q = str_replace('{$__cakeID__$}', implode(', ', $i), $query);
$q = str_replace('= (', 'IN (', $q);
$res = $this->fetchAll($q, $model->cacheQueries, $model->alias);
$fetch = array_merge($fetch, $res);
@ -1021,7 +1021,7 @@ class DboOracle extends DboSource {
$fetch = array();
$ins = array_chunk($ins, 1000);
foreach ($ins as $i) {
$q = str_replace('{$__cakeID__$}', '(' .join(', ', $i) .')', $query);
$q = str_replace('{$__cakeID__$}', '(' .implode(', ', $i) .')', $query);
$q = str_replace('= (', 'IN (', $q);
$q = str_replace(' WHERE 1 = 1', '', $q);

View file

@ -539,11 +539,11 @@ class DboPostgres extends DboSource {
}
if (!empty($colList)) {
$out .= "\t" . join(",\n\t", $colList) . ";\n\n";
$out .= "\t" . implode(",\n\t", $colList) . ";\n\n";
} else {
$out = '';
}
$out .= join(";\n\t", $this->_alterIndexes($curTable, $indexes)) . ";";
$out .= implode(";\n\t", $this->_alterIndexes($curTable, $indexes)) . ";";
}
}
return $out;
@ -580,7 +580,7 @@ class DboPostgres extends DboSource {
$out .= 'INDEX ';
}
if (is_array($value['column'])) {
$out .= $name . ' ON ' . $table . ' (' . join(', ', array_map(array(&$this, 'name'), $value['column'])) . ')';
$out .= $name . ' ON ' . $table . ' (' . implode(', ', array_map(array(&$this, 'name'), $value['column'])) . ')';
} else {
$out .= $name . ' ON ' . $table . ' (' . $this->name($value['column']) . ')';
}
@ -829,7 +829,7 @@ class DboPostgres 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']);
}
@ -862,7 +862,7 @@ class DboPostgres extends DboSource {
foreach (array('columns', 'indexes') as $var) {
if (is_array(${$var})) {
${$var} = join($join[$var], array_filter(${$var}));
${$var} = implode($join[$var], array_filter(${$var}));
}
}
return "CREATE TABLE {$table} (\n\t{$columns}\n);\n{$indexes}";

View file

@ -529,7 +529,7 @@ class DboSqlite 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']);
}
@ -589,7 +589,7 @@ class DboSqlite extends DboSource {
foreach (array('columns', 'indexes') as $var) {
if (is_array(${$var})) {
${$var} = "\t" . join(",\n\t", array_filter(${$var}));
${$var} = "\t" . implode(",\n\t", array_filter(${$var}));
}
}
return "CREATE TABLE {$table} (\n{$columns});\n{$indexes}";

View file

@ -580,8 +580,8 @@ class DboSource extends DataSource {
}
$query = array(
'table' => $this->fullTableName($model),
'fields' => join(', ', $fieldInsert),
'values' => join(', ', $valueInsert)
'fields' => implode(', ', $fieldInsert),
'values' => implode(', ', $valueInsert)
);
if ($this->execute($this->renderStatement('create', $query))) {
@ -796,7 +796,7 @@ class DboSource extends DataSource {
}
if (!empty($ins)) {
if (count($ins) > 1) {
$query = str_replace('{$__cakeID__$}', '(' .join(', ', $ins) .')', $query);
$query = str_replace('{$__cakeID__$}', '(' .implode(', ', $ins) .')', $query);
$query = str_replace('= (', 'IN (', $query);
$query = str_replace('= (', 'IN (', $query);
} else {
@ -895,7 +895,7 @@ class DboSource extends DataSource {
* @return array Association results
*/
function fetchAssociated($model, $query, $ids) {
$query = str_replace('{$__cakeID__$}', join(', ', $ids), $query);
$query = str_replace('{$__cakeID__$}', implode(', ', $ids), $query);
if (count($ids) > 1) {
$query = str_replace('= (', 'IN (', $query);
$query = str_replace('= (', 'IN (', $query);
@ -1272,12 +1272,12 @@ class DboSource extends DataSource {
}
return $this->renderStatement('select', array(
'conditions' => $this->conditions($query['conditions'], true, true, $model),
'fields' => join(', ', $query['fields']),
'fields' => implode(', ', $query['fields']),
'table' => $query['table'],
'alias' => $this->alias . $this->name($query['alias']),
'order' => $this->order($query['order']),
'limit' => $this->limit($query['limit'], $query['offset']),
'joins' => join(' ', $query['joins']),
'joins' => implode(' ', $query['joins']),
'group' => $this->group($query['group'])
));
}
@ -1324,7 +1324,7 @@ class DboSource extends DataSource {
case 'schema':
foreach (array('columns', 'indexes') as $var) {
if (is_array(${$var})) {
${$var} = "\t" . join(",\n\t", array_filter(${$var}));
${$var} = "\t" . implode(",\n\t", array_filter(${$var}));
}
}
if (trim($indexes) != '') {
@ -1378,7 +1378,7 @@ class DboSource extends DataSource {
} else {
$combined = array_combine($fields, $values);
}
$fields = join(', ', $this->_prepareUpdateFields($model, $combined, empty($conditions)));
$fields = implode(', ', $this->_prepareUpdateFields($model, $combined, empty($conditions)));
$alias = $joins = null;
$table = $this->fullTableName($model);
@ -1728,7 +1728,7 @@ class DboSource extends DataSource {
} else {
$field[0] = explode('.', $field[1]);
if (!Set::numeric($field[0])) {
$field[0] = join('.', array_map(array($this, 'name'), $field[0]));
$field[0] = implode('.', array_map(array($this, 'name'), $field[0]));
$fields[$i] = preg_replace('/\(' . $field[1] . '\)/', '(' . $field[0] . ')', $fields[$i], 1);
}
}
@ -1760,7 +1760,7 @@ class DboSource extends DataSource {
if (empty($out)) {
return $clause . ' 1 = 1';
}
return $clause . join(' AND ', $out);
return $clause . implode(' AND ', $out);
}
if (empty($conditions) || trim($conditions) == '' || $conditions === true) {
@ -1829,7 +1829,7 @@ class DboSource extends DataSource {
$out[] = $value[0] ;
}
} else {
$out[] = '(' . $not . '(' . join(') ' . strtoupper($key) . ' (', $value) . '))';
$out[] = '(' . $not . '(' . implode(') ' . strtoupper($key) . ' (', $value) . '))';
}
} else {
@ -1856,13 +1856,13 @@ class DboSource extends DataSource {
if (is_object($model)) {
$columnType = $model->getColumnType($key);
}
$data .= join(', ', $this->value($value, $columnType));
$data .= implode(', ', $this->value($value, $columnType));
}
$data .= ')';
} else {
$ret = $this->conditionKeysToString($value, $quoteValues, $model);
if (count($ret) > 1) {
$data = '(' . join(') AND (', $ret) . ')';
$data = '(' . implode(') AND (', $ret) . ')';
} elseif (isset($ret[0])) {
$data = $ret[0];
}
@ -1896,7 +1896,7 @@ class DboSource extends DataSource {
* @access private
*/
function __parseKey($model, $key, $value) {
$operatorMatch = '/^((' . join(')|(', $this->__sqlOps);
$operatorMatch = '/^((' . implode(')|(', $this->__sqlOps);
$operatorMatch .= '\\x20)|<[>=]?(?![^>]+>)\\x20?|[>=!]{1,3}(?!<)\\x20?)/is';
$bound = (strpos($key, '?') !== false || (is_array($value) && strpos($key, ':') !== false));
@ -1942,7 +1942,7 @@ class DboSource extends DataSource {
$operator = trim($operator);
if (is_array($value)) {
$value = join(', ', $value);
$value = implode(', ', $value);
switch ($operator) {
case '=':
@ -2069,7 +2069,7 @@ class DboSource extends DataSource {
}
$order[] = $this->order($key . $value);
}
return ' ORDER BY ' . trim(str_replace('ORDER BY', '', join(',', $order)));
return ' ORDER BY ' . trim(str_replace('ORDER BY', '', implode(',', $order)));
}
$keys = preg_replace('/ORDER\\x20BY/i', '', $keys);
@ -2100,7 +2100,7 @@ class DboSource extends DataSource {
function group($group) {
if ($group) {
if (is_array($group)) {
$group = join(', ', $group);
$group = implode(', ', $group);
}
return ' GROUP BY ' . $this->__quoteFields($group);
}
@ -2224,7 +2224,7 @@ class DboSource extends DataSource {
function insertMulti($table, $fields, $values) {
$table = $this->fullTableName($table);
if (is_array($fields)) {
$fields = join(', ', array_map(array(&$this, 'name'), $fields));
$fields = implode(', ', array_map(array(&$this, 'name'), $fields));
}
$count = count($values);
for ($x = 0; $x < $count; $x++) {
@ -2396,7 +2396,7 @@ class DboSource extends DataSource {
$name = $this->startQuote . $name . $this->endQuote;
}
if (is_array($value['column'])) {
$out .= 'KEY ' . $name . ' (' . join(', ', array_map(array(&$this, 'name'), $value['column'])) . ')';
$out .= 'KEY ' . $name . ' (' . implode(', ', array_map(array(&$this, 'name'), $value['column'])) . ')';
} else {
$out .= 'KEY ' . $name . ' (' . $this->name($value['column']) . ')';
}

View file

@ -1340,7 +1340,7 @@ class Model extends Overloadable {
if ($isUUID && $primaryAdded) {
$values[] = $db->value(String::uuid());
}
$values = join(',', $values);
$values = implode(',', $values);
$newValues[] = "({$values})";
unset($values);
} elseif (isset($row[$this->hasAndBelongsToMany[$assoc]['associationForeignKey']])) {
@ -1368,7 +1368,7 @@ class Model extends Overloadable {
}
if (!empty($newValues)) {
$fields = join(',', $fields);
$fields = implode(',', $fields);
$db->insertMulti($this->{$join}, $fields, $newValues);
}
}

View file

@ -334,19 +334,19 @@ 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));
} else {
$col = "\t\t'indexes' => array(";
$props = array();
foreach ((array)$value as $key => $index) {
$props[] = "'{$key}' => array(" . join(', ', $this->__values($index)) . ")";
$props[] = "'{$key}' => array(" . implode(', ', $this->__values($index)) . ")";
}
$col .= join(', ', $props);
$col .= implode(', ', $props);
}
$col .= ")";
$cols[] = $col;
}
$out .= join(",\n", $cols);
$out .= implode(",\n", $cols);
}
$out .= "\n\t);\n";
}
@ -447,7 +447,7 @@ class CakeSchema extends Object {
if (is_array($values)) {
foreach ($values as $key => $val) {
if (is_array($val)) {
$vals[] = "'{$key}' => array('" . join("', '", $val) . "')";
$vals[] = "'{$key}' => array('" . implode("', '", $val) . "')";
} else if (!is_numeric($key)) {
$val = var_export($val, true);
$vals[] = "'{$key}' => {$val}";

View file

@ -378,7 +378,7 @@ class Router extends Object {
$parsed[] = '/' . $element;
}
}
return array('#^' . join('', $parsed) . '[\/]*$#', $names);
return array('#^' . implode('', $parsed) . '[\/]*$#', $names);
}
/**
* Returns the list of prefixes used in connected routes
@ -880,11 +880,11 @@ class Router extends Object {
if ($_this->__admin && isset($url[$_this->__admin])) {
array_unshift($urlOut, $_this->__admin);
}
$output = join('/', $urlOut) . '/';
$output = implode('/', $urlOut) . '/';
}
if (!empty($args)) {
$args = join('/', $args);
$args = implode('/', $args);
if ($output{strlen($output) - 1} != '/') {
$args = '/'. $args;
}
@ -1066,7 +1066,7 @@ class Router extends Object {
for ($i = 0; $i < $count; $i++) {
$named[] = $keys[$i] . $this->named['separator'] . $params['named'][$keys[$i]];
}
$params['named'] = join('/', $named);
$params['named'] = implode('/', $named);
}
$params['pass'] = str_replace('//', '/', $params['pass'] . '/' . $params['named']);
}

View file

@ -413,7 +413,7 @@ class Set extends Object {
if (count($context['trace']) == 1) {
$context['trace'][] = $context['key'];
}
$parent = join('/', $context['trace']) . '/.';
$parent = implode('/', $context['trace']) . '/.';
$context['item'] = Set::extract($parent, $data);
$context['key'] = array_pop($context['trace']);
if (isset($context['trace'][1]) && $context['trace'][1] > 0) {

View file

@ -313,7 +313,7 @@ class Helper extends Overloadable {
if ($setScope) {
$view->modelScope = false;
} elseif (join('.', $view->entity()) == $entity) {
} elseif (implode('.', $view->entity()) == $entity) {
return;
}
@ -530,7 +530,7 @@ class Helper extends Overloadable {
$name = $field;
break;
default:
$name = 'data[' . join('][', $view->entity()) . ']';
$name = 'data[' . implode('][', $view->entity()) . ']';
break;
}

View file

@ -251,7 +251,7 @@ class AjaxHelper extends AppHelper {
$options['requestHeaders'] = array();
}
if (is_array($options['update'])) {
$options['update'] = join(' ', $options['update']);
$options['update'] = implode(' ', $options['update']);
}
$options['requestHeaders']['X-Update'] = $options['update'];
} else {
@ -799,7 +799,7 @@ class AjaxHelper extends AppHelper {
$keys[] = "'" . $key . "'";
$keys[] = "'" . $val . "'";
}
$jsOptions['requestHeaders'] = '[' . join(', ', $keys) . ']';
$jsOptions['requestHeaders'] = '[' . implode(', ', $keys) . ']';
break;
}
}
@ -846,7 +846,7 @@ class AjaxHelper extends AppHelper {
}
}
$out = join(', ', $out);
$out = implode(', ', $out);
$out = '{' . $out . '}';
return $out;
} else {
@ -965,7 +965,7 @@ class AjaxHelper extends AppHelper {
$data[] = $key . ':"' . rawurlencode($val) . '"';
}
}
$out = 'var __ajaxUpdater__ = {' . join(", \n", $data) . '};' . "\n";
$out = 'var __ajaxUpdater__ = {' . implode(", \n", $data) . '};' . "\n";
$out .= 'for (n in __ajaxUpdater__) { if (typeof __ajaxUpdater__[n] == "string"';
$out .= ' && $(n)) Element.update($(n), unescape(decodeURIComponent(';
$out .= '__ajaxUpdater__[n]))); }';

View file

@ -355,7 +355,7 @@ class FormHelper extends AppHelper {
}
}
}
$field = join('.', $field);
$field = implode('.', $field);
if (!in_array($field, $this->fields)) {
if ($value !== null) {
return $this->fields[$field] = $value;
@ -585,7 +585,7 @@ class FormHelper extends AppHelper {
function input($fieldName, $options = array()) {
$view =& ClassRegistry::getObject('view');
$this->setEntity($fieldName);
$entity = join('.', $view->entity());
$entity = implode('.', $view->entity());
$defaults = array('before' => null, 'between' => null, 'after' => null);
$options = array_merge($defaults, $options);
@ -952,7 +952,7 @@ class FormHelper extends AppHelper {
'id' => $attributes['id'] . '_', 'value' => '', 'name' => $attributes['name']
));
}
$out = $hidden . join($inbetween, $out);
$out = $hidden . implode($inbetween, $out);
if ($legend) {
$out = sprintf(

View file

@ -398,9 +398,9 @@ class HtmlHelper extends AppHelper {
$out[] = $key.':'.$value.';';
}
if ($inline) {
return join(' ', $out);
return implode(' ', $out);
}
return join("\n", $out);
return implode("\n", $out);
}
/**
* Returns the breadcrumb trail as a sequence of &raquo;-separated links.
@ -423,7 +423,7 @@ class HtmlHelper extends AppHelper {
$out[] = $crumb[0];
}
}
return $this->output(join($separator, $out));
return $this->output(implode($separator, $out));
} else {
return null;
}
@ -481,7 +481,7 @@ class HtmlHelper extends AppHelper {
foreach ($names as $arg) {
$out[] = sprintf($this->tags['tableheader'], $this->_parseAttributes($thOptions), $arg);
}
$data = sprintf($this->tags['tablerow'], $this->_parseAttributes($trOptions), join(' ', $out));
$data = sprintf($this->tags['tablerow'], $this->_parseAttributes($trOptions), implode(' ', $out));
return $this->output($data);
}
/**
@ -531,9 +531,9 @@ class HtmlHelper extends AppHelper {
$cellsOut[] = sprintf($this->tags['tablecell'], $this->_parseAttributes($cellOptions), $cell);
}
$options = $this->_parseAttributes($count % 2 ? $oddTrOptions : $evenTrOptions);
$out[] = sprintf($this->tags['tablerow'], $options, join(' ', $cellsOut));
$out[] = sprintf($this->tags['tablerow'], $options, implode(' ', $cellsOut));
}
return $this->output(join("\n", $out));
return $this->output(implode("\n", $out));
}
/**
* Returns a formatted block tag, i.e DIV, SPAN, P.

View file

@ -649,9 +649,9 @@ class JavascriptHelper extends AppHelper {
}
if (!$numeric) {
$rt = '{' . join(',', $out) . '}';
$rt = '{' . implode(',', $out) . '}';
} else {
$rt = '[' . join(',', $out) . ']';
$rt = '[' . implode(',', $out) . ']';
}
}
$rt = $options['prefix'] . $rt . $options['postfix'];

View file

@ -128,7 +128,7 @@ class JsHelper extends Overloadable2 {
$options['requestHeaders'] = array();
}
if (is_array($options['update'])) {
$options['update'] = join(' ', $options['update']);
$options['update'] = implode(' ', $options['update']);
}
$options['requestHeaders']['X-Update'] = $options['update'];
} else {
@ -257,9 +257,9 @@ class JsHelper extends Overloadable2 {
}
if (!$numeric) {
$rt = '{' . join(', ', $out) . '}';
$rt = '{' . implode(', ', $out) . '}';
} else {
$rt = '[' . join(', ', $out) . ']';
$rt = '[' . implode(', ', $out) . ']';
}
$rt = $prefix . $rt . $postfix;
@ -445,7 +445,7 @@ class JsHelperObject {
}
$options[] = $key . ':' . $val;
}
return join(', ', $options);
return implode(', ', $options);
}
}
?>

View file

@ -209,7 +209,7 @@ class RssHelper extends XmlHelper {
}
$categories[] = $this->elem($key, $attrib, $category);
}
$elements[$key] = join('', $categories);
$elements[$key] = implode('', $categories);
continue 2;
} else if (is_array($val) && isset($val['domain'])) {
$attrib['domain'] = $val['domain'];
@ -259,7 +259,7 @@ class RssHelper extends XmlHelper {
$elements[$key] = $this->elem($key, $attrib, $val);
}
if (!empty($elements)) {
$content = join('', $elements);
$content = implode('', $elements);
}
return $this->output($this->elem('item', $att, $content, !($content === null)));
}

View file

@ -437,7 +437,7 @@ class View extends Object {
$data_for_layout = array_merge($this->viewVars, array(
'title_for_layout' => $pageTitle,
'content_for_layout' => $content_for_layout,
'scripts_for_layout' => join("\n\t", $this->__scripts),
'scripts_for_layout' => implode("\n\t", $this->__scripts),
'cakeDebug' => $debug
));

View file

@ -634,10 +634,10 @@ class CakeTestCase extends UnitTestCase {
$permutations = $this->__array_permute($attrs);
$permutationTokens = array();
foreach ($permutations as $permutation) {
$permutationTokens[] = join('', $permutation);
$permutationTokens[] = implode('', $permutation);
}
$regex[] = array(
sprintf('%s', join(', ', $explanations)),
sprintf('%s', implode(', ', $explanations)),
$permutationTokens,
$i,
);

View file

@ -575,7 +575,7 @@ class HtmlTestManager extends TestManager {
foreach ($testCases as $testCaseFile => $testCase) {
$title = explode(strpos($testCase, '\\') ? '\\' : '/', str_replace('.test.php', '', $testCase));
$title[count($title) - 1] = Inflector::camelize($title[count($title) - 1]);
$title = join(' / ', $title);
$title = implode(' / ', $title);
$buffer .= "<li><a href='" . $manager->getBaseURL() . "?case=" . urlencode($testCase) . $urlExtra ."'>" . $title . "</a></li>\n";
}