Skip to content

Commit

Permalink
Removing =& operators for construction of objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Nov 13, 2010
1 parent 8c2f9e1 commit 18bb5f6
Show file tree
Hide file tree
Showing 55 changed files with 133 additions and 133 deletions.
2 changes: 1 addition & 1 deletion cake/console/shells/acl.php
Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions cake/console/shells/console.php
Expand Up @@ -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('--------------');
Expand Down Expand Up @@ -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.");
Expand All @@ -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):
Expand Down Expand Up @@ -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());
Expand Down
18 changes: 9 additions & 9 deletions cake/console/shells/schema.php
Expand Up @@ -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'));
}

/**
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand All @@ -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)) {
Expand Down Expand Up @@ -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));
Expand All @@ -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();

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion cake/console/shells/tasks/controller.php
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions cake/console/shells/tasks/fixture.php
Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions cake/console/shells/tasks/model.php
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions cake/console/shells/tasks/plugin.php
Expand Up @@ -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',
Expand All @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions cake/console/shells/tasks/template.php
Expand Up @@ -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];

Expand All @@ -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)) {
Expand Down
6 changes: 3 additions & 3 deletions cake/console/shells/tasks/test.php
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions cake/console/shells/tasks/view.php
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion cake/console/templates/default/classes/test.ctp
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/cache/memcache.php
Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions cake/libs/controller/components/acl.php
Expand Up @@ -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;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/controller/components/auth.php
Expand Up @@ -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 = '';
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/controller/controller.php
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/file.php
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions cake/libs/http_socket.php
Expand Up @@ -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
* ));
Expand Down
6 changes: 3 additions & 3 deletions cake/libs/magic_db.php
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions cake/libs/model/behaviors/containable.php
Expand Up @@ -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);
Expand Down Expand Up @@ -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])) {
Expand Down
6 changes: 3 additions & 3 deletions cake/libs/model/behaviors/translate.php
Expand Up @@ -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),
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 18bb5f6

Please sign in to comment.