coordinator->getRegistrationContext(); if ($context === null) { throw new Exception("Can't retrieve public share template providers as context is not defined"); } $providers = array_map( fn ($registration) => Server::get($registration->getService()), $context->getPublicShareTemplateProviders() ); $filteredProviders = array_filter( $providers, fn (IPublicShareTemplateProvider $provider) => $provider->shouldRespond($share) ); if (count($filteredProviders) === 0) { return $this->defaultProvider; } else { return array_shift($filteredProviders); } } }