Skip to content

Commit

Permalink
Removing E_STRICT errors from ClassRegistry
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Nov 9, 2010
1 parent 09011d1 commit 62017b2
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions cake/libs/class_registry.php
Expand Up @@ -64,7 +64,7 @@ class ClassRegistry {
public static function &getInstance() {
static $instance = array();
if (!$instance) {
$instance[0] =& new ClassRegistry();
$instance[0] = new ClassRegistry();
}
return $instance[0];
}
Expand Down Expand Up @@ -94,7 +94,7 @@ public static function &getInstance() {
* @return object instance of ClassName
*/
public static function &init($class, $type = null) {
$_this =& ClassRegistry::getInstance();
$_this = ClassRegistry::getInstance();
$id = $false = false;
$true = true;

Expand Down Expand Up @@ -129,21 +129,21 @@ public static function &init($class, $type = null) {
}
$alias = $settings['alias'];

if ($model =& $_this->__duplicate($alias, $class)) {
if ($model = $_this->__duplicate($alias, $class)) {
$_this->map($alias, $class);
return $model;
}

if (class_exists($class) || App::import($type, $pluginPath . $class)) {
${$class} =& new $class($settings);
${$class} = new $class($settings);
} elseif ($type === 'Model') {
if ($plugin && class_exists($plugin . 'AppModel')) {
$appModel = $plugin . 'AppModel';
} else {
$appModel = 'AppModel';
}
$settings['name'] = $class;
${$class} =& new $appModel($settings);
${$class} = new $appModel($settings);
}

if (!isset(${$class})) {
Expand Down Expand Up @@ -176,10 +176,10 @@ public static function &init($class, $type = null) {
* @return boolean True if the object was written, false if $key already exists
*/
public static function addObject($key, &$object) {
$_this =& ClassRegistry::getInstance();
$_this = ClassRegistry::getInstance();
$key = Inflector::underscore($key);
if (!isset($_this->__objects[$key])) {
$_this->__objects[$key] =& $object;
$_this->__objects[$key] = $object;
return true;
}
return false;
Expand All @@ -192,7 +192,7 @@ public static function addObject($key, &$object) {
* @return void
*/
public static function removeObject($key) {
$_this =& ClassRegistry::getInstance();
$_this = ClassRegistry::getInstance();
$key = Inflector::underscore($key);
if (isset($_this->__objects[$key])) {
unset($_this->__objects[$key]);
Expand All @@ -206,7 +206,7 @@ public static function removeObject($key) {
* @return boolean true if key exists in registry, false otherwise
*/
public static function isKeySet($key) {
$_this =& ClassRegistry::getInstance();
$_this = ClassRegistry::getInstance();
$key = Inflector::underscore($key);
if (isset($_this->__objects[$key])) {
return true;
Expand All @@ -222,7 +222,7 @@ public static function isKeySet($key) {
* @return array Set of keys stored in registry
*/
public static function keys() {
$_this =& ClassRegistry::getInstance();
$_this = ClassRegistry::getInstance();
return array_keys($_this->__objects);
}

Expand All @@ -233,15 +233,15 @@ public static function keys() {
* @return mixed Object stored in registry or boolean false if the object does not exist.
*/
public static function &getObject($key) {
$_this =& ClassRegistry::getInstance();
$_this = ClassRegistry::getInstance();
$key = Inflector::underscore($key);
$return = false;
if (isset($_this->__objects[$key])) {
$return =& $_this->__objects[$key];
$return = $_this->__objects[$key];
} else {
$key = $_this->__getMap($key);
if (isset($_this->__objects[$key])) {
$return =& $_this->__objects[$key];
$return = $_this->__objects[$key];
}
}
return $return;
Expand All @@ -257,7 +257,7 @@ public static function &getObject($key) {
* the previously-set value of $param, or null if not set.
*/
public static function config($type, $param = array()) {
$_this =& ClassRegistry::getInstance();
$_this = ClassRegistry::getInstance();

if (empty($param) && is_array($type)) {
$param = $type;
Expand All @@ -280,9 +280,9 @@ public static function config($type, $param = array()) {
private function &__duplicate($alias, $class) {
$duplicate = false;
if ($this->isKeySet($alias)) {
$model =& $this->getObject($alias);
$model = $this->getObject($alias);
if (is_object($model) && (is_a($model, $class) || $model->alias === $class)) {
$duplicate =& $model;
$duplicate = $model;
}
unset($model);
}
Expand All @@ -296,7 +296,7 @@ private function &__duplicate($alias, $class) {
* @param string $name Key that is being mapped
*/
public static function map($key, $name) {
$_this =& ClassRegistry::getInstance();
$_this = ClassRegistry::getInstance();
$key = Inflector::underscore($key);
$name = Inflector::underscore($name);
if (!isset($_this->__map[$key])) {
Expand All @@ -310,7 +310,7 @@ public static function map($key, $name) {
* @return array Keys of registry's map
*/
public static function mapKeys() {
$_this =& ClassRegistry::getInstance();
$_this = ClassRegistry::getInstance();
return array_keys($_this->__map);
}

Expand All @@ -332,7 +332,7 @@ private function __getMap($key) {
* @return void
*/
public static function flush() {
$_this =& ClassRegistry::getInstance();
$_this = ClassRegistry::getInstance();
$_this->__objects = array();
$_this->__map = array();
}
Expand Down

0 comments on commit 62017b2

Please sign in to comment.