Skip to content

Commit

Permalink
Merge pull request #78 from nextcloud/fix/routing/multiple-register-r…
Browse files Browse the repository at this point in the history
…outes
  • Loading branch information
provokateurin authored Jan 18, 2024
2 parents c69ac97 + f4a3e78 commit 3b7b6ff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public static function parseRoutes(string $path): array {
}
return include($path);
} elseif (str_contains($content, "registerRoutes")) {
preg_match("/registerRoutes\(.*?\\\$this,.*?(\[[^;]*)\);/s", $content, $matches);
return self::includeRoutes("<?php\nreturn " . $matches[1] . ";");
preg_match_all("/registerRoutes\(.*?\\\$this,.*?(\[[^;]*)\);/s", $content, $matches);
return array_merge(...array_map(fn (string $match) => self::includeRoutes("<?php\nreturn " . $match . ";"), $matches[1]));
} else {
Logger::panic("Routes", "Unknown routes.php format");
}
Expand Down

0 comments on commit 3b7b6ff

Please sign in to comment.