Skip to content
Permalink
Browse files

Removing =& operators for construction of objects.

  • Loading branch information...
markstory committed Nov 13, 2010
1 parent 8c2f9e1 commit 18bb5f6b8b9d8f98fdbc42d652637430c8ee867b
Showing with 133 additions and 133 deletions.
  1. +1 −1 cake/console/shells/acl.php
  2. +4 −4 cake/console/shells/console.php
  3. +9 −9 cake/console/shells/schema.php
  4. +1 −1 cake/console/shells/tasks/controller.php
  5. +2 −2 cake/console/shells/tasks/fixture.php
  6. +4 −4 cake/console/shells/tasks/model.php
  7. +2 −2 cake/console/shells/tasks/plugin.php
  8. +3 −3 cake/console/shells/tasks/template.php
  9. +3 −3 cake/console/shells/tasks/test.php
  10. +2 −2 cake/console/shells/tasks/view.php
  11. +1 −1 cake/console/templates/default/classes/test.ctp
  12. +1 −1 cake/libs/cache/memcache.php
  13. +2 −2 cake/libs/controller/components/acl.php
  14. +1 −1 cake/libs/controller/components/auth.php
  15. +1 −1 cake/libs/controller/controller.php
  16. +1 −1 cake/libs/file.php
  17. +2 −2 cake/libs/http_socket.php
  18. +3 −3 cake/libs/magic_db.php
  19. +2 −2 cake/libs/model/behaviors/containable.php
  20. +3 −3 cake/libs/model/behaviors/translate.php
  21. +1 −1 cake/libs/model/datasources/dbo_source.php
  22. +1 −1 cake/libs/view/helpers/cache.php
  23. +1 −1 cake/tests/cases/console/libs/shell.test.php
  24. +2 −2 cake/tests/cases/console/shells/schema.test.php
  25. +1 −1 cake/tests/cases/console/shells/tasks/test.test.php
  26. +2 −2 cake/tests/cases/libs/cache/file.test.php
  27. +5 −5 cake/tests/cases/libs/cache/memcache.test.php
  28. +1 −1 cake/tests/cases/libs/cake_request.test.php
  29. +1 −1 cake/tests/cases/libs/controller/component.test.php
  30. +1 −1 cake/tests/cases/libs/controller/components/email.test.php
  31. +3 −3 cake/tests/cases/libs/controller/controller.test.php
  32. +5 −5 cake/tests/cases/libs/controller/controller_merge_vars.test.php
  33. +1 −1 cake/tests/cases/libs/controller/scaffold.test.php
  34. +1 −1 cake/tests/cases/libs/file.test.php
  35. +4 −4 cake/tests/cases/libs/l10n.test.php
  36. +2 −2 cake/tests/cases/libs/log/file_log.test.php
  37. +1 −1 cake/tests/cases/libs/magic_db.test.php
  38. +1 −1 cake/tests/cases/libs/model/behaviors/containable.test.php
  39. +5 −5 cake/tests/cases/libs/model/cake_schema.test.php
  40. +5 −5 cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php
  41. +1 −1 cake/tests/cases/libs/model/datasources/dbo/dbo_mysqli.test.php
  42. +1 −1 cake/tests/cases/libs/model/datasources/dbo/dbo_oracle.test.php
  43. +3 −3 cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php
  44. +3 −3 cake/tests/cases/libs/model/datasources/dbo_source.test.php
  45. +6 −6 cake/tests/cases/libs/model/db_acl.test.php
  46. +2 −2 cake/tests/cases/libs/model/model_delete.test.php
  47. +5 −5 cake/tests/cases/libs/model/model_read.test.php
  48. +8 −8 cake/tests/cases/libs/model/model_validation.test.php
  49. +4 −4 cake/tests/cases/libs/model/model_write.test.php
  50. +1 −1 cake/tests/cases/libs/object.test.php
  51. +1 −1 cake/tests/cases/libs/route/cake_route.test.php
  52. +2 −2 cake/tests/cases/libs/sanitize.test.php
  53. +1 −1 cake/tests/cases/libs/view/helpers/html.test.php
  54. +2 −2 cake/tests/cases/libs/view/view.test.php
  55. +1 −1 cake/tests/lib/templates/footer.php
@@ -94,7 +94,7 @@ public function startup() {
if (!in_array($this->command, array('initdb'))) {
$collection = new ComponentCollection();
$this->Acl =& new AclComponent($collection);
$this->Acl = new AclComponent($collection);
$controller = null;
$this->Acl->startup($controller);
}
@@ -61,7 +61,7 @@ public function initialize() {
foreach ($this->models as $model) {
$class = Inflector::camelize(str_replace('.php', '', $model));
$this->models[$model] = $class;
$this->{$class} =& new $class();
$this->{$class} = new $class();
}
$this->out('Model classes:');
$this->out('--------------');
@@ -290,7 +290,7 @@ public function main($command = null) {
}
break;
case (preg_match("/^routes\s+reload/i", $command, $tmp) == true):
$router =& Router::getInstance();
$router = Router::getInstance();
if (!$this->_loadRoutes()) {
$this->out("There was an error loading the routes config. Please check that the file");
$this->out("exists and is free of parse errors.");
@@ -299,7 +299,7 @@ public function main($command = null) {
$this->out("Routes configuration reloaded, " . count($router->routes) . " routes connected");
break;
case (preg_match("/^routes\s+show/i", $command, $tmp) == true):
$router =& Router::getInstance();
$router = Router::getInstance();
$this->out(implode("\n", Set::extract($router->routes, '{n}.0')));
break;
case (preg_match("/^route\s+(\(.*\))$/i", $command, $tmp) == true):
@@ -335,7 +335,7 @@ protected function _isValidModel($modelToCheck) {
* @return boolean True if config reload was a success, otherwise false
*/
protected function _loadRoutes() {
$router =& Router::getInstance();
$router = Router::getInstance();
$router->reload();
extract($router->getNamedExpressions());
@@ -99,7 +99,7 @@ public function startup() {
$name = $plugin;
}
}
$this->Schema =& new CakeSchema(compact('name', 'path', 'file', 'connection', 'plugin'));
$this->Schema = new CakeSchema(compact('name', 'path', 'file', 'connection', 'plugin'));
}
/**
@@ -151,7 +151,7 @@ public function generate() {
$content['file'] = $this->params['file'];
if ($snapshot === true) {
$Folder =& new Folder($this->Schema->path);
$Folder = new Folder($this->Schema->path);
$result = $Folder->read();
$numToUse = false;
@@ -209,7 +209,7 @@ public function dump() {
$write = $this->params['write'];
}
}
$db =& ConnectionManager::getDataSource($this->Schema->connection);
$db = ConnectionManager::getDataSource($this->Schema->connection);
$contents = "#" . $Schema->name . " sql generated on: " . date('Y-m-d H:i:s') . " : " . time() . "\n\n";
$contents .= $db->dropSchema($Schema) . "\n\n". $db->createSchema($Schema);
@@ -218,9 +218,9 @@ public function dump() {
$write .= '.sql';
}
if (strpos($write, DS) !== false) {
$File =& new File($write, true);
$File = new File($write, true);
} else {
$File =& new File($this->Schema->path . DS . $write, true);
$File = new File($this->Schema->path . DS . $write, true);
}
if ($File->write($contents)) {
@@ -280,7 +280,7 @@ function _loadSchema() {
$options['file'] = $fileName . '_' . $this->params['snapshot'] . '.php';
}
$Schema =& $this->Schema->load($options);
$Schema = $this->Schema->load($options);
if (!$Schema) {
$this->err(sprintf(__('%s could not be loaded'), $this->Schema->path . DS . $this->Schema->file));
@@ -300,7 +300,7 @@ function _loadSchema() {
* @access private
*/
function __create(&$Schema, $table = null) {
$db =& ConnectionManager::getDataSource($this->Schema->connection);
$db = ConnectionManager::getDataSource($this->Schema->connection);
$drop = $create = array();
@@ -343,7 +343,7 @@ function __create(&$Schema, $table = null) {
* @access private
*/
function __update(&$Schema, $table = null) {
$db =& ConnectionManager::getDataSource($this->Schema->connection);
$db = ConnectionManager::getDataSource($this->Schema->connection);
$this->out(__('Comparing Database to Schema...'));
$options = array();
@@ -390,7 +390,7 @@ function __run($contents, $event, &$Schema) {
return;
}
Configure::write('debug', 2);
$db =& ConnectionManager::getDataSource($this->Schema->connection);
$db = ConnectionManager::getDataSource($this->Schema->connection);
foreach ($contents as $table => $sql) {
if (empty($sql)) {
@@ -278,7 +278,7 @@ public function bakeActions($controllerName, $admin = null, $wannaUseSession = t
$this->_stop();
}
$modelObj =& ClassRegistry::init($currentModelName);
$modelObj = ClassRegistry::init($currentModelName);
$controllerPath = $this->_controllerPath($controllerName);
$pluralName = $this->_pluralName($currentModelName);
$singularName = Inflector::variable($currentModelName);
@@ -394,12 +394,12 @@ protected function _getRecordsFromTable($modelName, $useTable = null) {
$condition = 'WHERE 1=1 LIMIT ' . (isset($this->params['count']) ? $this->params['count'] : 10);
}
App::import('Model', 'Model', false);
$modelObject =& new Model(array('name' => $modelName, 'table' => $useTable, 'ds' => $this->connection));
$modelObject = new Model(array('name' => $modelName, 'table' => $useTable, 'ds' => $this->connection));
$records = $modelObject->find('all', array(
'conditions' => $condition,
'recursive' => -1
));
$db =& ConnectionManager::getDataSource($modelObject->useDbConfig);
$db = ConnectionManager::getDataSource($modelObject->useDbConfig);
$schema = $modelObject->schema(true);
$out = array();
foreach ($records as $record) {
@@ -131,7 +131,7 @@ protected function &_getModelObject($className, $table = null) {
if (!$table) {
$table = Inflector::tableize($className);
}
$object =& new Model(array('name' => $className, 'table' => $table, 'ds' => $this->connection));
$object = new Model(array('name' => $className, 'table' => $table, 'ds' => $this->connection));
return $object;
}
@@ -180,7 +180,7 @@ protected function _interactive() {
}
$currentModelName = $this->getName();
$useTable = $this->getTable($currentModelName);
$db =& ConnectionManager::getDataSource($this->connection);
$db = ConnectionManager::getDataSource($this->connection);
$fullTableName = $db->fullTableName($useTable);
if (in_array($useTable, $this->_tables)) {
@@ -793,7 +793,7 @@ public function getTable($modelName, $useDbConfig = null) {
}
App::import('Model', 'ConnectionManager', false);
$db =& ConnectionManager::getDataSource($useDbConfig);
$db = ConnectionManager::getDataSource($useDbConfig);
$useTable = Inflector::tableize($modelName);
$fullTableName = $db->fullTableName($useTable, false);
$tableIsGood = false;
@@ -823,7 +823,7 @@ public function getAllTables($useDbConfig = null) {
App::import('Model', 'ConnectionManager', false);
$tables = array();
$db =& ConnectionManager::getDataSource($useDbConfig);
$db = ConnectionManager::getDataSource($useDbConfig);
$db->cacheSources = false;
$usePrefix = empty($db->config['prefix']) ? '' : $db->config['prefix'];
if ($usePrefix) {
@@ -104,7 +104,7 @@ public function bake($plugin) {
$looksGood = $this->in(__('Look okay?'), array('y', 'n', 'q'), 'y');
if (strtolower($looksGood) == 'y') {
$Folder =& new Folder($this->path . $pluginPath);
$Folder = new Folder($this->path . $pluginPath);
$directories = array(
'config' . DS . 'schema',
'models' . DS . 'behaviors',
@@ -127,7 +127,7 @@ public function bake($plugin) {
foreach ($directories as $directory) {
$dirPath = $this->path . $pluginPath . DS . $directory;
$Folder->create($dirPath);
$File =& new File($dirPath . DS . 'empty', true);
$File = new File($dirPath . DS . 'empty', true);
}
foreach ($Folder->messages() as $message) {
@@ -59,7 +59,7 @@ protected function _findThemes() {
$separator = DS === '/' ? '/' : '\\\\';
$core = preg_replace('#shells' . $separator . '$#', '', $core);
$paths[] = $core;
$Folder =& new Folder($core . 'templates' . DS . 'default');
$Folder = new Folder($core . 'templates' . DS . 'default');
$contents = $Folder->read();
$themeFolders = $contents[0];
@@ -76,14 +76,14 @@ protected function _findThemes() {
$themes = array();
foreach ($paths as $path) {
$Folder =& new Folder($path . 'templates', false);
$Folder = new Folder($path . 'templates', false);
$contents = $Folder->read();
$subDirs = $contents[0];
foreach ($subDirs as $dir) {
if (empty($dir) || preg_match('@^skel$|_skel$@', $dir)) {
continue;
}
$Folder =& new Folder($path . 'templates' . DS . $dir);
$Folder = new Folder($path . 'templates' . DS . $dir);
$contents = $Folder->read();
$subDirs = $contents[0];
if (array_intersect($contents[0], $themeFolders)) {
@@ -115,7 +115,7 @@ protected function _interactive($type = null) {
public function bake($type, $className) {
if ($this->typeCanDetectFixtures($type) && $this->isLoadableClass($type, $className)) {
$this->out(__('Bake is detecting possible fixtures..'));
$testSubject =& $this->buildTestSubject($type, $className);
$testSubject = $this->buildTestSubject($type, $className);
$this->generateFixtureList($testSubject);
} elseif ($this->interactive) {
$this->getUserFixtures();
@@ -228,9 +228,9 @@ public function &buildTestSubject($type, $class) {
App::import($type, $class);
$class = $this->getRealClassName($type, $class);
if (strtolower($type) == 'model') {
$instance =& ClassRegistry::init($class);
$instance = ClassRegistry::init($class);
} else {
$instance =& new $class();
$instance = new $class();
}
return $instance;
}
@@ -282,11 +282,11 @@ private function __loadController() {
$this->_stop();
}
$controllerClassName = $this->controllerName . 'Controller';
$controllerObj =& new $controllerClassName();
$controllerObj = new $controllerClassName();
$controllerObj->plugin = $this->plugin;
$controllerObj->constructClasses();
$modelClass = $controllerObj->modelClass;
$modelObj =& $controllerObj->{$controllerObj->modelClass};
$modelObj = $controllerObj->{$controllerObj->modelClass};
if ($modelObj) {
$primaryKey = $modelObj->primaryKey;
@@ -39,7 +39,7 @@ class <?php echo $fullClassName; ?>TestCase extends CakeTestCase {

<?php endif; ?>
public function startTest() {
$this-><?php echo $className . ' =& ' . $construction; ?>
$this-><?php echo $className . ' = ' . $construction; ?>
}

public function endTest() {
@@ -78,7 +78,7 @@ public function init($settings = array()) {
}
if (!isset($this->__Memcache)) {
$return = false;
$this->__Memcache =& new Memcache();
$this->__Memcache = new Memcache();
foreach ($this->settings['servers'] as $server) {
list($host, $port) = $this->_parseServerString($server);
if ($this->__Memcache->addServer($host, $port)) {
@@ -280,8 +280,8 @@ function __construct() {
* @return void
*/
public function initialize($component) {
$component->Aro =& $this->Aro;
$component->Aco =& $this->Aco;
$component->Aro = $this->Aro;
$component->Aco = $this->Aco;
}
/**
@@ -322,7 +322,7 @@ public function startup(&$controller) {
if (!$this->__setDefaults()) {
return false;
}
$request =& $controller->request;
$request = $controller->request;
$this->request->data = $controller->request->data = $this->hashPasswords($request->data);
$url = '';
@@ -627,7 +627,7 @@ public function loadModel($modelClass = null, $id = null) {
if ($this->persistModel === true) {
$this->_persist($modelClass, true, $this->{$modelClass});
$registry =& ClassRegistry::getInstance();
$registry = ClassRegistry::getInstance();
$this->_persist($modelClass . 'registry', true, $registry->__objects, 'registry');
}
} else {
@@ -93,7 +93,7 @@ class File {
* @access private
*/
function __construct($path, $create = false, $mode = 0755) {
$this->Folder =& new Folder(dirname($path), $create, $mode);
$this->Folder = new Folder(dirname($path), $create, $mode);
if (!is_dir($path)) {
$this->name = basename($path);
}
@@ -146,12 +146,12 @@ class HttpSocket extends CakeSocket {
* You can use a url string to set the url and use default configurations for
* all other options:
*
* `$http =& new HttpSockect('http://cakephp.org/');`
* `$http = new HttpSockect('http://cakephp.org/');`
*
* Or use an array to configure multiple options:
*
* {{{
* $http =& new HttpSocket(array(
* $http = new HttpSocket(array(
* 'host' => 'cakephp.org',
* 'timeout' => 20
* ));
@@ -53,7 +53,7 @@ function read($magicDb = null) {
if (is_array($magicDb) || strpos($magicDb, '# FILE_ID DB') === 0) {
$data = $magicDb;
} else {
$File =& new File($magicDb);
$File = new File($magicDb);
if (!$File->exists()) {
return false;
}
@@ -155,7 +155,7 @@ public function analyze($file, $options = array()) {
}
$matches = array();
$MagicFileResource =& new MagicFileResource($file);
$MagicFileResource = new MagicFileResource($file);
foreach ($this->db['database'] as $format) {
$magic = $format[0];
$match = $MagicFileResource->test($magic);
@@ -201,7 +201,7 @@ class MagicFileResource extends Object{
*/
public function __construct($file) {
if (file_exists($file)) {
$this->resource =& new File($file);
$this->resource = new File($file);
} else {
$this->resource = $file;
}
@@ -121,7 +121,7 @@ public function beforeFind(&$Model, $query) {
$mandatory = array();
foreach ($containments['models'] as $name => $model) {
$instance =& $model['instance'];
$instance = $model['instance'];
$needed = $this->fieldDependencies($instance, $map, false);
if (!empty($needed)) {
$mandatory = array_merge($mandatory, $needed);
@@ -431,7 +431,7 @@ public function fieldDependencies(&$Model, $map, $fields = array()) {
public function containmentsMap($containments) {
$map = array();
foreach ($containments['models'] as $name => $model) {
$instance =& $model['instance'];
$instance = $model['instance'];
foreach ($this->types as $type) {
foreach ($instance->{$type} as $assoc => $options) {
if (isset($model['keep'][$assoc])) {
@@ -52,7 +52,7 @@ class TranslateBehavior extends ModelBehavior {
* @return mixed
*/
public function setup(&$model, $config = array()) {
$db =& ConnectionManager::getDataSource($model->useDbConfig);
$db = ConnectionManager::getDataSource($model->useDbConfig);
if (!$db->connected) {
trigger_error(
sprintf(__('Datasource %s for TranslateBehavior of model %s is not connected'), $model->useDbConfig, $model->alias),
@@ -91,8 +91,8 @@ public function beforeFind(&$model, $query) {
if (empty($locale)) {
return $query;
}
$db =& ConnectionManager::getDataSource($model->useDbConfig);
$RuntimeModel =& $this->translateModel($model);
$db = ConnectionManager::getDataSource($model->useDbConfig);
$RuntimeModel = $this->translateModel($model);
if (!empty($RuntimeModel->tablePrefix)) {
$tablePrefix = $RuntimeModel->tablePrefix;
} else {
Oops, something went wrong.

0 comments on commit 18bb5f6

Please sign in to comment.
You can’t perform that action at this time.