Permalink
Browse files

Replace complicated $$foo with simple variable.

  • Loading branch information...
1 parent 42f9f8e commit 2c7854cc2f6fe176c21e6e12acc6ee601aacfcaf @markstory markstory committed Nov 13, 2011
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/Cake/Utility/ClassRegistry.php
@@ -133,12 +133,12 @@ public static function init($class, $strict = false) {
App::uses($class, $pluginPath . 'Model');
if (class_exists($class)) {
- ${$class} = new $class($settings);
+ $instance = new $class($settings);
if ($strict) {
- ${$class} = (${$class} instanceof Model) ? ${$class} : null;
+ $instance = ($instance instanceof Model) ? $instance : null;
}
}
- if (!isset(${$class})) {
+ if (!isset($instance)) {
if ($strict) {
return false;
} elseif ($plugin && class_exists($plugin . 'AppModel')) {
@@ -148,10 +148,10 @@ public static function init($class, $strict = false) {
}
if (!empty($appModel)) {
$settings['name'] = $class;
- ${$class} = new $appModel($settings);
+ $instance = new $appModel($settings);
}
- if (!isset(${$class})) {
+ if (!isset($instance)) {
trigger_error(__d('cake_dev', '(ClassRegistry::init() could not create instance of %1$s class %2$s ', $class, $type), E_USER_WARNING);
return $false;
}
@@ -166,7 +166,7 @@ public static function init($class, $strict = false) {
if ($count > 1) {
return $true;
}
- return ${$class};
+ return $instance;
}
/**

0 comments on commit 2c7854c

Please sign in to comment.