1234567891011121314151617181920212223242526 |
- <?php
- namespace Juju\App;
- require_once('router.class.php');
- abstract class Controller {
- private $name;
- public abstract static function handle(Router $router);
- public static function controllers(){
- return array_filter(get_declared_classes(), function($class){
- return 0 === strpos($class, "Controller\\");
- });
- }
- public static function handle_all(Router $router){
- foreach(self::controllers() as $controller){
- $controller::handle($router);
- }
- }
- public static function name(){
- if(is_null(static::$name)){
- $name = get_called_class();
- return substr($name, strrpos($name, '\\') + 1);
- }
- return static::$name;
- }
- }
- ?>
|