Skip to content
This repository
Browse code

changing join() to implode() for consistency

  • Loading branch information...
commit a38a616cba8786f851cac31d973131db046295c4 1 parent ccd3378
Carl Sutton authored September 15, 2012
2  lib/Cake/Configure/IniReader.php
@@ -180,7 +180,7 @@ public function dump($filename, $data) {
180 180
 				}
181 181
 			}
182 182
 		}
183  
-		$contents = join("\n", $result);
  183
+		$contents = implode("\n", $result);
184 184
 
185 185
 		if (substr($filename, -4) !== '.ini') {
186 186
 			$filename .= '.ini';
8  lib/Cake/I18n/I18n.php
@@ -592,19 +592,19 @@ protected function _parseLiteralValue($string) {
592 592
 		$string = $string[1];
593 593
 		if (substr($string, 0, 2) === $this->_escape . 'x') {
594 594
 			$delimiter = $this->_escape . 'x';
595  
-			return join('', array_map('chr', array_map('hexdec',array_filter(explode($delimiter, $string)))));
  595
+			return implode('', array_map('chr', array_map('hexdec',array_filter(explode($delimiter, $string)))));
596 596
 		}
597 597
 		if (substr($string, 0, 2) === $this->_escape . 'd') {
598 598
 			$delimiter = $this->_escape . 'd';
599  
-			return join('', array_map('chr', array_filter(explode($delimiter, $string))));
  599
+			return implode('', array_map('chr', array_filter(explode($delimiter, $string))));
600 600
 		}
601 601
 		if ($string[0] === $this->_escape && isset($string[1]) && is_numeric($string[1])) {
602 602
 			$delimiter = $this->_escape;
603  
-			return join('', array_map('chr', array_filter(explode($delimiter, $string))));
  603
+			return implode('', array_map('chr', array_filter(explode($delimiter, $string))));
604 604
 		}
605 605
 		if (substr($string, 0, 3) === 'U00') {
606 606
 			$delimiter = 'U00';
607  
-			return join('', array_map('chr', array_map('hexdec', array_filter(explode($delimiter, $string)))));
  607
+			return implode('', array_map('chr', array_map('hexdec', array_filter(explode($delimiter, $string)))));
608 608
 		}
609 609
 		if (preg_match('/U([0-9a-fA-F]{4})/', $string, $match)) {
610 610
 			return Multibyte::ascii(array(hexdec($match[1])));
10  lib/Cake/Model/CakeSchema.php
@@ -418,26 +418,26 @@ public function generateTable($table, $fields) {
418 418
 					}
419 419
 					$col = "\t\t'{$field}' => array('type' => '" . $value['type'] . "', ";
420 420
 					unset($value['type']);
421  
-					$col .= join(', ',  $this->_values($value));
  421
+					$col .= implode(', ',  $this->_values($value));
422 422
 				} elseif ($field == 'indexes') {
423 423
 					$col = "\t\t'indexes' => array(\n\t\t\t";
424 424
 					$props = array();
425 425
 					foreach ((array)$value as $key => $index) {
426  
-						$props[] = "'{$key}' => array(" . join(', ',  $this->_values($index)) . ")";
  426
+						$props[] = "'{$key}' => array(" . implode(', ',  $this->_values($index)) . ")";
427 427
 					}
428  
-					$col .= join(",\n\t\t\t", $props) . "\n\t\t";
  428
+					$col .= implode(",\n\t\t\t", $props) . "\n\t\t";
429 429
 				} elseif ($field == 'tableParameters') {
430 430
 					$col = "\t\t'tableParameters' => array(";
431 431
 					$props = array();
432 432
 					foreach ((array)$value as $key => $param) {
433 433
 						$props[] = "'{$key}' => '$param'";
434 434
 					}
435  
-					$col .= join(', ', $props);
  435
+					$col .= implode(', ', $props);
436 436
 				}
437 437
 				$col .= ")";
438 438
 				$cols[] = $col;
439 439
 			}
440  
-			$out .= join(",\n", $cols);
  440
+			$out .= implode(",\n", $cols);
441 441
 		}
442 442
 		$out .= "\n\t);\n";
443 443
 		return $out;
6  lib/Cake/Model/Datasource/Database/Sqlite.php
@@ -459,7 +459,7 @@ public function buildIndex($indexes, $table = null) {
459 459
 				$out .= 'UNIQUE ';
460 460
 			}
461 461
 			if (is_array($value['column'])) {
462  
-				$value['column'] = join(', ', array_map(array(&$this, 'name'), $value['column']));
  462
+				$value['column'] = implode(', ', array_map(array(&$this, 'name'), $value['column']));
463 463
 			} else {
464 464
 				$value['column'] = $this->name($value['column']);
465 465
 			}
@@ -524,10 +524,10 @@ public function renderStatement($type, $data) {
524 524
 			case 'schema':
525 525
 				extract($data);
526 526
 				if (is_array($columns)) {
527  
-					$columns = "\t" . join(",\n\t", array_filter($columns));
  527
+					$columns = "\t" . implode(",\n\t", array_filter($columns));
528 528
 				}
529 529
 				if (is_array($indexes)) {
530  
-					$indexes = "\t" . join("\n\t", array_filter($indexes));
  530
+					$indexes = "\t" . implode("\n\t", array_filter($indexes));
531 531
 				}
532 532
 				return "CREATE TABLE {$table} (\n{$columns});\n{$indexes}";
533 533
 			default:
2  lib/Cake/Model/Datasource/DboSource.php
@@ -1766,7 +1766,7 @@ public function renderStatement($type, $data) {
1766 1766
 			case 'schema':
1767 1767
 				foreach (array('columns', 'indexes', 'tableParameters') as $var) {
1768 1768
 					if (is_array(${$var})) {
1769  
-						${$var} = "\t" . join(",\n\t", array_filter(${$var}));
  1769
+						${$var} = "\t" . implode(",\n\t", array_filter(${$var}));
1770 1770
 					} else {
1771 1771
 						${$var} = '';
1772 1772
 					}
2  lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
@@ -3270,7 +3270,7 @@ public function testVirtualFieldsFetch() {
3270 3270
 		);
3271 3271
 
3272 3272
 		$conditions = array('comment_count >' => 2);
3273  
-		$query = 'SELECT ' . join(',', $this->Dbo->fields($Article, null, array('id', 'comment_count'))) .
  3273
+		$query = 'SELECT ' . implode(',', $this->Dbo->fields($Article, null, array('id', 'comment_count'))) .
3274 3274
 				' FROM ' . $this->Dbo->fullTableName($Article) . ' Article ' . $this->Dbo->conditions($conditions, true, true, $Article);
3275 3275
 		$result = $this->Dbo->fetchAll($query);
3276 3276
 		$expected = array(array(
6  lib/Cake/Utility/Debugger.php
@@ -318,7 +318,7 @@ public static function trace($options = array()) {
318 318
 						foreach ($next['args'] as $arg) {
319 319
 							$args[] = Debugger::exportVar($arg);
320 320
 						}
321  
-						$reference .= join(', ', $args);
  321
+						$reference .= implode(', ', $args);
322 322
 					}
323 323
 					$reference .= ')';
324 324
 				}
@@ -779,11 +779,11 @@ public function outputError($data) {
779 779
 				continue;
780 780
 			}
781 781
 			if (is_array($value)) {
782  
-				$value = join("\n", $value);
  782
+				$value = implode("\n", $value);
783 783
 			}
784 784
 			$info .= String::insert($tpl[$key], array($key => $value) + $data, $insertOpts);
785 785
 		}
786  
-		$links = join(' ', $links);
  786
+		$links = implode(' ', $links);
787 787
 
788 788
 		if (isset($tpl['callback']) && is_callable($tpl['callback'])) {
789 789
 			return call_user_func($tpl['callback'], $data, compact('links', 'info'));
4  lib/Cake/Utility/Inflector.php
@@ -406,8 +406,8 @@ public static function singularize($word) {
406 406
 		}
407 407
 
408 408
 		if (!isset(self::$_singular['cacheUninflected']) || !isset(self::$_singular['cacheIrregular'])) {
409  
-			self::$_singular['cacheUninflected'] = '(?:' . join('|', self::$_singular['merged']['uninflected']) . ')';
410  
-			self::$_singular['cacheIrregular'] = '(?:' . join('|', array_keys(self::$_singular['merged']['irregular'])) . ')';
  409
+			self::$_singular['cacheUninflected'] = '(?:' . implode('|', self::$_singular['merged']['uninflected']) . ')';
  410
+			self::$_singular['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$_singular['merged']['irregular'])) . ')';
411 411
 		}
412 412
 
413 413
 		if (preg_match('/(.*)\\b(' . self::$_singular['cacheIrregular'] . ')$/i', $word, $regs)) {
2  lib/Cake/View/Helper.php
@@ -607,7 +607,7 @@ public function domId($options = null, $id = 'id') {
607 607
 
608 608
 		$entity = $this->entity();
609 609
 		$model = array_shift($entity);
610  
-		$dom = $model . join('', array_map(array('Inflector', 'camelize'), $entity));
  610
+		$dom = $model . implode('', array_map(array('Inflector', 'camelize'), $entity));
611 611
 
612 612
 		if (is_array($options) && !array_key_exists($id, $options)) {
613 613
 			$options[$id] = $dom;
2  lib/Cake/View/Helper/FormHelper.php
@@ -274,7 +274,7 @@ public function tagIsInvalid() {
274 274
 		if (empty($errors)) {
275 275
 			return false;
276 276
 		}
277  
-		$errors = Hash::get($errors, join('.', $entity));
  277
+		$errors = Hash::get($errors, implode('.', $entity));
278 278
 		return $errors === null ? false : $errors;
279 279
 	}
280 280
 
6  lib/Cake/View/Helper/HtmlHelper.php
@@ -637,7 +637,7 @@ public function style($data, $oneline = true) {
637 637
 			$out[] = $key . ':' . $value . ';';
638 638
 		}
639 639
 		if ($oneline) {
640  
-			return join(' ', $out);
  640
+			return implode(' ', $out);
641 641
 		}
642 642
 		return implode("\n", $out);
643 643
 	}
@@ -669,7 +669,7 @@ public function getCrumbs($separator = '»', $startText = false) {
669 669
 					$out[] = $crumb[0];
670 670
 				}
671 671
 			}
672  
-			return join($separator, $out);
  672
+			return implode($separator, $out);
673 673
 		} else {
674 674
 			return null;
675 675
 		}
@@ -805,7 +805,7 @@ public function tableHeaders($names, $trOptions = null, $thOptions = null) {
805 805
 				$out[] = sprintf($this->_tags['tableheader'], $this->_parseAttributes(current($arg)), key($arg));
806 806
 			}
807 807
 		}
808  
-		return sprintf($this->_tags['tablerow'], $this->_parseAttributes($trOptions), join(' ', $out));
  808
+		return sprintf($this->_tags['tablerow'], $this->_parseAttributes($trOptions), implode(' ', $out));
809 809
 	}
810 810
 
811 811
 /**
2  lib/Cake/View/Helper/JsBaseEngineHelper.php
@@ -494,7 +494,7 @@ protected function _parseOptions($options, $safeKeys = array()) {
494 494
 			$out[] = $key . ':' . $value;
495 495
 		}
496 496
 		sort($out);
497  
-		return join(', ', $out);
  497
+		return implode(', ', $out);
498 498
 	}
499 499
 
500 500
 /**

0 notes on commit a38a616

Please sign in to comment.
Something went wrong with that request. Please try again.