Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/sdk-php. php sdk for openstatus www.openstatus.dev
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930<?php
declare(strict_types=1);
namespace Openstatus\Sdk\Tests\Support;
use Psr\Http\Client\ClientExceptionInterface;use Psr\Http\Client\ClientInterface;use Psr\Http\Message\RequestInterface;use Psr\Http\Message\ResponseInterface;
final class MockHttpClient implements ClientInterface{ public ?RequestInterface $lastRequest = null;
public function __construct( private readonly ResponseInterface|ClientExceptionInterface $responseOrError, ) { }
public function sendRequest(RequestInterface $request): ResponseInterface { $this->lastRequest = $request; if ($this->responseOrError instanceof ClientExceptionInterface) { throw $this->responseOrError; } return $this->responseOrError; }}