/**
* @param array{path: string, namespace: string} $resource
*/
public function load(mixed
$resource, string
$type = null
): ?RouteCollection
{ $path =
$this->locator->
locate($resource['path'
],
$this->currentDirectory
);
if (!
is_dir($path)) { return new RouteCollection();
} return $this->
loadFromDirectory($path,
trim($resource['namespace'
], '\\'
));
} public function supports(mixed
$resource, string
$type = null
): bool
{ return ('attribute' ===
$type || 'annotation' ===
$type) && \
is_array($resource) &&
isset($resource['path'
],
$resource['namespace'
]);
} public function forDirectory(string
$currentDirectory):
static { $loader =
clone $this;
$loader->currentDirectory =
$currentDirectory;