function requires() { $libs = func_get_args(); foreach ($libs as $lib) { $lib_file = PND_DIR . $lib . DIRECTORY_SEPARATOR . "{$lib}.php"; if (!file_exists($lib_file)) { trigger_error_("Requires non-existent lib {$lib}", E_USER_ERROR); } require_once $lib_file; } }
function handler_macro($method, $paths, $conds, $func) { $req = request_(); $handler = handler_($method, $paths, $conds, $func); if (handler_match_($handler, $req, $matches)) { if (is_callable($handler['func'])) { call_user_func_array($handler['func'], array_merge(array($req, $matches))); } else { trigger_error_("Invalid handler macro func", E_USER_ERROR); } } }