Making singleton access use a class property.

This commit is contained in:
Mark Story 2010-04-19 23:56:36 -04:00
parent 7bf594ff17
commit 661c76802c

View file

@ -26,6 +26,13 @@
*/
class Router {
/**
* Instance for the singleton
*
* @var Router
*/
protected static $_instance;
/**
* Array of routes connected with Router::connect()
*
@ -184,12 +191,10 @@ class Router {
* @return Router Instance of the Router.
*/
public static function &getInstance() {
static $instance = array();
if (!$instance) {
$instance[0] =& new Router();
if (!self::$_instance) {
self::$_instance = new Router();
}
return $instance[0];
return self::$_instance;
}
/**