update lock clucknut
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 14s
Build, Push and Deploy / build-and-push (push) Successful in 3m14s
Build, Push and Deploy / deploy-staging (push) Successful in 25s
Build, Push and Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-04-18 20:32:18 +07:00
parent 4554035227
commit dcaf267458
3359 changed files with 153185 additions and 205489 deletions

View File

@@ -38,12 +38,13 @@ public function __construct(
*/
public function load(mixed $resource, ?string $type = null): ?RouteCollection
{
$excluded = $resource['_excluded'] ?? [];
$path = $this->locator->locate($resource['path'], $this->currentDirectory);
if (!is_dir($path)) {
return new RouteCollection();
}
return $this->loadFromDirectory($path, trim($resource['namespace'], '\\'));
return $this->loadFromDirectory($path, trim($resource['namespace'], '\\'), $excluded);
}
public function supports(mixed $resource, ?string $type = null): bool
@@ -59,7 +60,7 @@ public function forDirectory(string $currentDirectory): static
return $loader;
}
private function loadFromDirectory(string $directory, string $psr4Prefix): RouteCollection
private function loadFromDirectory(string $directory, string $psr4Prefix, array $excluded = []): RouteCollection
{
$collection = new RouteCollection();
$collection->addResource(new DirectoryResource($directory, '/\.php$/'));
@@ -74,8 +75,13 @@ private function loadFromDirectory(string $directory, string $psr4Prefix): Route
/** @var \SplFileInfo $file */
foreach ($files as $file) {
$normalizedPath = rtrim(str_replace('\\', '/', $file->getPathname()), '/');
if (isset($excluded[$normalizedPath])) {
continue;
}
if ($file->isDir()) {
$collection->addCollection($this->loadFromDirectory($file->getPathname(), $psr4Prefix.'\\'.$file->getFilename()));
$collection->addCollection($this->loadFromDirectory($file->getPathname(), $psr4Prefix.'\\'.$file->getFilename(), $excluded));
continue;
}