A bit of api cleanup. Don't get excited. This is like a 0.005% cleanup but you have to start somewhere.
This commit is contained in:
24
Zotlabs/Lib/Api_router.php
Normal file
24
Zotlabs/Lib/Api_router.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Zotlabs\Lib;
|
||||
|
||||
|
||||
class Api_router {
|
||||
|
||||
static private $routes = array();
|
||||
|
||||
static function register($path,$fn,$auth_required) {
|
||||
self::$routes[$path] = [ 'func' => $fn, 'auth' => $auth_required ];
|
||||
}
|
||||
|
||||
static function find($path) {
|
||||
if(array_key_exists($path,self::$routes))
|
||||
return self::$routes[$path];
|
||||
return null;
|
||||
}
|
||||
|
||||
static function dbg() {
|
||||
return self::$routes;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user