Skip to content

Commit

Permalink
Added Controller::instance() to avoid need for global
Browse files Browse the repository at this point in the history
  • Loading branch information
lux committed Oct 17, 2023
1 parent 016cd00 commit eba16b3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ class Controller {
* Template object.
*/
private $_tpl;

/**
* Controller object.
*/
private static $_instance;

/**
* A list of apps whose hooks have been loaded already.
Expand All @@ -293,6 +298,14 @@ public function __construct ($hooks = array ()) {
}
}
self::$hooks = $hooks;
self::$_instance = $this;
}

/**
* Get the controller instance.
*/
public static function instance () {
return self::$_instance;
}

/**
Expand Down

0 comments on commit eba16b3

Please sign in to comment.