public static function init() { if (null !== self::$_instance) { return self::$_instance; } self::$_instance = new self(); return self::$_instance; }
/** * Init the router and returns it * * @return Router */ public static function getInstance() { if (self::$_instance === null) { self::$_instance = new self(); //get the routes if (is_file(CONFIG_DIR . self::$routeFile) && empty(self::$routes)) { self::$routes = (include CONFIG_DIR . self::$routeFile); //sort by lenght of route url uasort(self::$routes, function ($a, $b) { return strlen($b['url']) - strlen($a['url']); }); } } return self::$_instance; }