Merge pull request #848 from dogmatic69/removing-alias-function-calls

Removing alias function calls
This commit is contained in:
Mark Story 2012-09-15 17:59:03 -07:00
commit 7f76f70287
21 changed files with 40 additions and 40 deletions

View file

@ -366,7 +366,7 @@ class Cache {
} }
$key = self::$_engines[$config]->key($key); $key = self::$_engines[$config]->key($key);
if (!$key || !is_integer($offset) || $offset < 0) { if (!$key || !is_int($offset) || $offset < 0) {
return false; return false;
} }
$success = self::$_engines[$config]->increment($settings['prefix'] . $key, $offset); $success = self::$_engines[$config]->increment($settings['prefix'] . $key, $offset);
@ -394,7 +394,7 @@ class Cache {
} }
$key = self::$_engines[$config]->key($key); $key = self::$_engines[$config]->key($key);
if (!$key || !is_integer($offset) || $offset < 0) { if (!$key || !is_int($offset) || $offset < 0) {
return false; return false;
} }
$success = self::$_engines[$config]->decrement($settings['prefix'] . $key, $offset); $success = self::$_engines[$config]->decrement($settings['prefix'] . $key, $offset);

View file

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

View file

@ -86,7 +86,7 @@ if (!empty($failed)) {
} }
if (Configure::read('debug') < 1) { if (Configure::read('debug') < 1) {
die(__d('cake_dev', 'Debug setting does not allow access to this url.')); exit(__d('cake_dev', 'Debug setting does not allow access to this url.'));
} }
require_once CAKE . 'TestSuite' . DS . 'CakeTestSuiteDispatcher.php'; require_once CAKE . 'TestSuite' . DS . 'CakeTestSuiteDispatcher.php';

View file

@ -398,7 +398,7 @@ class CookieComponent extends Component {
return $this->_expires = 0; return $this->_expires = 0;
} }
if (is_integer($expires) || is_numeric($expires)) { if (is_int($expires) || is_numeric($expires)) {
return $this->_expires = $now + intval($expires); return $this->_expires = $now + intval($expires);
} }
return $this->_expires = strtotime($expires, $now); return $this->_expires = strtotime($expires, $now);

View file

@ -592,19 +592,19 @@ class I18n {
$string = $string[1]; $string = $string[1];
if (substr($string, 0, 2) === $this->_escape . 'x') { if (substr($string, 0, 2) === $this->_escape . 'x') {
$delimiter = $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') { if (substr($string, 0, 2) === $this->_escape . 'd') {
$delimiter = $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])) { if ($string[0] === $this->_escape && isset($string[1]) && is_numeric($string[1])) {
$delimiter = $this->_escape; $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') { if (substr($string, 0, 3) === 'U00') {
$delimiter = '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)) { if (preg_match('/U([0-9a-fA-F]{4})/', $string, $match)) {
return Multibyte::ascii(array(hexdec($match[1]))); 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'] . "', "; $col = "\t\t'{$field}' => array('type' => '" . $value['type'] . "', ";
unset($value['type']); unset($value['type']);
$col .= join(', ', $this->_values($value)); $col .= implode(', ', $this->_values($value));
} elseif ($field == 'indexes') { } elseif ($field == 'indexes') {
$col = "\t\t'indexes' => array(\n\t\t\t"; $col = "\t\t'indexes' => array(\n\t\t\t";
$props = array(); $props = array();
foreach ((array)$value as $key => $index) { 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') { } elseif ($field == 'tableParameters') {
$col = "\t\t'tableParameters' => array("; $col = "\t\t'tableParameters' => array(";
$props = array(); $props = array();
foreach ((array)$value as $key => $param) { foreach ((array)$value as $key => $param) {
$props[] = "'{$key}' => '$param'"; $props[] = "'{$key}' => '$param'";
} }
$col .= join(', ', $props); $col .= implode(', ', $props);
} }
$col .= ")"; $col .= ")";
$cols[] = $col; $cols[] = $col;
} }
$out .= join(",\n", $cols); $out .= implode(",\n", $cols);
} }
$out .= "\n\t);\n"; $out .= "\n\t);\n";
return $out; return $out;

View file

@ -459,7 +459,7 @@ class Sqlite extends DboSource {
$out .= 'UNIQUE '; $out .= 'UNIQUE ';
} }
if (is_array($value['column'])) { 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 { } else {
$value['column'] = $this->name($value['column']); $value['column'] = $this->name($value['column']);
} }
@ -524,10 +524,10 @@ class Sqlite extends DboSource {
case 'schema': case 'schema':
extract($data); extract($data);
if (is_array($columns)) { if (is_array($columns)) {
$columns = "\t" . join(",\n\t", array_filter($columns)); $columns = "\t" . implode(",\n\t", array_filter($columns));
} }
if (is_array($indexes)) { 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}"; return "CREATE TABLE {$table} (\n{$columns});\n{$indexes}";
default: default:

View file

@ -1766,7 +1766,7 @@ class DboSource extends DataSource {
case 'schema': case 'schema':
foreach (array('columns', 'indexes', 'tableParameters') as $var) { foreach (array('columns', 'indexes', 'tableParameters') as $var) {
if (is_array(${$var})) { if (is_array(${$var})) {
${$var} = "\t" . join(",\n\t", array_filter(${$var})); ${$var} = "\t" . implode(",\n\t", array_filter(${$var}));
} else { } else {
${$var} = ''; ${$var} = '';
} }

View file

@ -746,7 +746,7 @@ class CakeResponse {
* @return void * @return void
*/ */
public function cache($since, $time = '+1 day') { public function cache($since, $time = '+1 day') {
if (!is_integer($time)) { if (!is_int($time)) {
$time = strtotime($time); $time = strtotime($time);
} }
$this->header(array( $this->header(array(
@ -1008,7 +1008,7 @@ class CakeResponse {
protected function _getUTCDate($time = null) { protected function _getUTCDate($time = null) {
if ($time instanceof DateTime) { if ($time instanceof DateTime) {
$result = clone $time; $result = clone $time;
} elseif (is_integer($time)) { } elseif (is_int($time)) {
$result = new DateTime(date('Y-m-d H:i:s', $time)); $result = new DateTime(date('Y-m-d H:i:s', $time));
} else { } else {
$result = new DateTime($time); $result = new DateTime($time);

View file

@ -219,7 +219,7 @@ class CakeRoute {
if (isset($route[$key])) { if (isset($route[$key])) {
continue; continue;
} }
if (is_integer($key)) { if (is_int($key)) {
$route['pass'][] = $value; $route['pass'][] = $value;
continue; continue;
} }

View file

@ -3270,7 +3270,7 @@ class MysqlTest extends CakeTestCase {
); );
$conditions = array('comment_count >' => 2); $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); ' FROM ' . $this->Dbo->fullTableName($Article) . ' Article ' . $this->Dbo->conditions($conditions, true, true, $Article);
$result = $this->Dbo->fetchAll($query); $result = $this->Dbo->fetchAll($query);
$expected = array(array( $expected = array(array(

View file

@ -61,7 +61,7 @@ class CakeTestSuiteTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testAddTestDirectoryRecursiveWithHidden() { public function testAddTestDirectoryRecursiveWithHidden() {
$this->skipIf(!is_writeable(TMP), 'Cant addTestDirectoryRecursiveWithHidden unless the tmp folder is writable.'); $this->skipIf(!is_writable(TMP), 'Cant addTestDirectoryRecursiveWithHidden unless the tmp folder is writable.');
$Folder = new Folder(TMP . 'MyTestFolder', true, 0777); $Folder = new Folder(TMP . 'MyTestFolder', true, 0777);
mkdir($Folder->path . DS . '.svn', 0777, true); mkdir($Folder->path . DS . '.svn', 0777, true);
@ -85,7 +85,7 @@ class CakeTestSuiteTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testAddTestDirectoryRecursiveWithNonPhp() { public function testAddTestDirectoryRecursiveWithNonPhp() {
$this->skipIf(!is_writeable(TMP), 'Cant addTestDirectoryRecursiveWithNonPhp unless the tmp folder is writable.'); $this->skipIf(!is_writable(TMP), 'Cant addTestDirectoryRecursiveWithNonPhp unless the tmp folder is writable.');
$Folder = new Folder(TMP . 'MyTestFolder', true, 0777); $Folder = new Folder(TMP . 'MyTestFolder', true, 0777);
touch($Folder->path . DS . 'BackupTest.php~'); touch($Folder->path . DS . 'BackupTest.php~');

View file

@ -374,7 +374,7 @@ class FolderTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testFolderReadWithHiddenFiles() { public function testFolderReadWithHiddenFiles() {
$this->skipIf(!is_writeable(TMP), 'Cant test Folder::read with hidden files unless the tmp folder is writable.'); $this->skipIf(!is_writable(TMP), 'Cant test Folder::read with hidden files unless the tmp folder is writable.');
$Folder = new Folder(TMP . 'folder_tree_hidden', true, 0777); $Folder = new Folder(TMP . 'folder_tree_hidden', true, 0777);
mkdir($Folder->path . DS . '.svn'); mkdir($Folder->path . DS . '.svn');
@ -457,7 +457,7 @@ class FolderTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testFolderTreeWithHiddenFiles() { public function testFolderTreeWithHiddenFiles() {
$this->skipIf(!is_writeable(TMP), 'Can\'t test Folder::tree with hidden files unless the tmp folder is writable.'); $this->skipIf(!is_writable(TMP), 'Can\'t test Folder::tree with hidden files unless the tmp folder is writable.');
$Folder = new Folder(TMP . 'folder_tree_hidden', true, 0777); $Folder = new Folder(TMP . 'folder_tree_hidden', true, 0777);
mkdir($Folder->path . DS . '.svn', 0777, true); mkdir($Folder->path . DS . '.svn', 0777, true);

View file

@ -310,7 +310,7 @@ class CakeTime {
return false; return false;
} }
if (is_integer($dateString) || is_numeric($dateString)) { if (is_int($dateString) || is_numeric($dateString)) {
$date = intval($dateString); $date = intval($dateString);
} elseif (is_object($dateString) && $dateString instanceof DateTime) { } elseif (is_object($dateString) && $dateString instanceof DateTime) {
$clone = clone $dateString; $clone = clone $dateString;
@ -589,7 +589,7 @@ class CakeTime {
if ($dateString instanceof DateTime) { if ($dateString instanceof DateTime) {
$date = $dateString; $date = $dateString;
} elseif (is_integer($dateString) || is_numeric($dateString)) { } elseif (is_int($dateString) || is_numeric($dateString)) {
$dateString = (int)$dateString; $dateString = (int)$dateString;
$date = new DateTime('@' . $dateString); $date = new DateTime('@' . $dateString);

View file

@ -318,7 +318,7 @@ class Debugger {
foreach ($next['args'] as $arg) { foreach ($next['args'] as $arg) {
$args[] = Debugger::exportVar($arg); $args[] = Debugger::exportVar($arg);
} }
$reference .= join(', ', $args); $reference .= implode(', ', $args);
} }
$reference .= ')'; $reference .= ')';
} }
@ -779,11 +779,11 @@ class Debugger {
continue; continue;
} }
if (is_array($value)) { if (is_array($value)) {
$value = join("\n", $value); $value = implode("\n", $value);
} }
$info .= String::insert($tpl[$key], array($key => $value) + $data, $insertOpts); $info .= String::insert($tpl[$key], array($key => $value) + $data, $insertOpts);
} }
$links = join(' ', $links); $links = implode(' ', $links);
if (isset($tpl['callback']) && is_callable($tpl['callback'])) { if (isset($tpl['callback']) && is_callable($tpl['callback'])) {
return call_user_func($tpl['callback'], $data, compact('links', 'info')); 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'])) { if (!isset(self::$_singular['cacheUninflected']) || !isset(self::$_singular['cacheIrregular'])) {
self::$_singular['cacheUninflected'] = '(?:' . join('|', self::$_singular['merged']['uninflected']) . ')'; self::$_singular['cacheUninflected'] = '(?:' . implode('|', self::$_singular['merged']['uninflected']) . ')';
self::$_singular['cacheIrregular'] = '(?:' . join('|', array_keys(self::$_singular['merged']['irregular'])) . ')'; self::$_singular['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$_singular['merged']['irregular'])) . ')';
} }
if (preg_match('/(.*)\\b(' . self::$_singular['cacheIrregular'] . ')$/i', $word, $regs)) { if (preg_match('/(.*)\\b(' . self::$_singular['cacheIrregular'] . ')$/i', $word, $regs)) {

View file

@ -174,7 +174,7 @@ class Xml {
throw new XmlException(__d('cake_dev', 'Invalid input.')); throw new XmlException(__d('cake_dev', 'Invalid input.'));
} }
$key = key($input); $key = key($input);
if (is_integer($key)) { if (is_int($key)) {
throw new XmlException(__d('cake_dev', 'The key of input must be alphanumeric')); throw new XmlException(__d('cake_dev', 'The key of input must be alphanumeric'));
} }

View file

@ -607,7 +607,7 @@ class Helper extends Object {
$entity = $this->entity(); $entity = $this->entity();
$model = array_shift($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)) { if (is_array($options) && !array_key_exists($id, $options)) {
$options[$id] = $dom; $options[$id] = $dom;

View file

@ -274,7 +274,7 @@ class FormHelper extends AppHelper {
if (empty($errors)) { if (empty($errors)) {
return false; return false;
} }
$errors = Hash::get($errors, join('.', $entity)); $errors = Hash::get($errors, implode('.', $entity));
return $errors === null ? false : $errors; return $errors === null ? false : $errors;
} }

View file

@ -637,7 +637,7 @@ class HtmlHelper extends AppHelper {
$out[] = $key . ':' . $value . ';'; $out[] = $key . ':' . $value . ';';
} }
if ($oneline) { if ($oneline) {
return join(' ', $out); return implode(' ', $out);
} }
return implode("\n", $out); return implode("\n", $out);
} }
@ -669,7 +669,7 @@ class HtmlHelper extends AppHelper {
$out[] = $crumb[0]; $out[] = $crumb[0];
} }
} }
return join($separator, $out); return implode($separator, $out);
} else { } else {
return null; return null;
} }
@ -805,7 +805,7 @@ class HtmlHelper extends AppHelper {
$out[] = sprintf($this->_tags['tableheader'], $this->_parseAttributes(current($arg)), key($arg)); $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; $out[] = $key . ':' . $value;
} }
sort($out); sort($out);
return join(', ', $out); return implode(', ', $out);
} }
/** /**