resolvers = $resolvers; } public function resolveCenters($entity, ?array $options = []): array { foreach ($this->resolvers as $resolver) { if ($resolver->supports($entity, $options)) { $resolved = $resolver->resolveCenter($entity, $options); if (null === $resolved) { return []; } if ($resolved instanceof Center) { return [$resolved]; } if (is_array($resolved)) { return $resolved; } throw new UnexpectedValueException(sprintf( 'the return type of a %s should be an instance of %s, an array or null. Resolver is %s', CenterResolverInterface::class, Center::class, get_class($resolver) )); } } return []; } }