mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Making singleton access use a class property.
This commit is contained in:
parent
7bf594ff17
commit
661c76802c
1 changed files with 10 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue