> */ private static array $providers = [ SlimResponseFactory::class, LaminasResponseFactory::class, Psr17Factory::class, HttpFactory::class, HttpSoftResponseFactory::class, ]; public function __construct(private ResponseFactoryInterface $responseFactory) { } public function createResponse(int $code = StatusCodeInterface::STATUS_OK, string $reasonPhrase = ''): Response { return new Response($this->responseFactory->createResponse($code, $reasonPhrase)); } /** @throws RuntimeException When no {@see ResponseFactoryInterface} implementation is found. */ public static function create(): self { foreach (self::$providers as $provider) { if (class_exists($provider)) { return new self(new $provider()); } } throw new RuntimeException('No HTTP response factories found.'); } }