19 public static function testRoutes($path, $method =
null): array {
21 if (isset ( $path )) {
22 $path = self::slashPath ( $path );
23 if (isset ( self::$routes [$path] )) {
27 foreach ( self::$routes as $routePath => $routeDetails ) {
28 if (\preg_match (
"@^{$routePath}\$@s", $path ) || $path ==
null) {
35 private static function addTestRoute(&$response, $path, $method =
null): void {
36 if (isset ( $method )) {
38 if (UString::startswith ( $method,
'-' )) {
40 $method = \ltrim ( $method,
'-' );
42 $routeMethod = self::getMethod ( self::$routes [$path] );
43 if ((\count ( $routeMethod ) == 0 && ! $restrict) || \array_search ( \strtolower ( $method ), $routeMethod ) !==
false) {
44 $response [$path] = self::$routes [$path];
47 $response [$path] = self::$routes [$path];