chore(previews): registerProvider->registerProviderClosure in PreviewManager

No longer part of the public interface. Just an internal utility function.

Apps/etc register in other ways and still end up here appropriately.

Signed-off-by: Josh <josh.t.richards@gmail.com>
This commit is contained in:
Josh 2026-04-24 16:50:28 -04:00 committed by Carl Schwan
parent 07bac538e2
commit bf9d97ec5a
No known key found for this signature in database
GPG key ID: 02325448204E452A

View file

@ -107,8 +107,7 @@ class PreviewManager implements IPreview {
* @param string $mimeTypeRegex Regex with the mime types that are supported by this provider
* @param ProviderClosure $callable
*/
#[\Override]
public function registerProvider(string $mimeTypeRegex, Closure $callable): void {
private function registerProviderClosure(string $mimeTypeRegex, Closure $callable): void {
if (!$this->enablePreviews) {
return;
}
@ -300,7 +299,7 @@ class PreviewManager implements IPreview {
*/
protected function registerCoreProvider(string $class, string $mimeType, array $options = []): void {
if (in_array(trim($class, '\\'), $this->getEnabledDefaultProvider())) {
$this->registerProvider($mimeType, function () use ($class, $options) {
$this->registerProviderClosure($mimeType, function () use ($class, $options): IProviderV2 {
return new $class($options);
});
}
@ -426,7 +425,7 @@ class PreviewManager implements IPreview {
}
$this->loadedBootstrapProviders[$key] = null;
$this->registerProvider($provider->getMimeTypeRegex(), function () use ($provider): IProviderV2|false {
$this->registerProviderClosure($provider->getMimeTypeRegex(), function () use ($provider): IProviderV2|false {
try {
return $this->container->get($provider->getService());
} catch (NotFoundExceptionInterface) {