Skip to content
Permalink
Browse files

Making singleton access use a class property.

  • Loading branch information...
markstory committed Apr 20, 2010
1 parent 7bf594f commit 661c76802c22b25e91e10e127bc736b9ae4039ac
Showing with 10 additions and 5 deletions.
  1. +10 −5 cake/libs/router.php
@@ -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 @@ function __setPrefixes() {
* @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;
}
/**

0 comments on commit 661c768

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