PluginProbe
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress / 9.1.3
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress v9.1.3
9.1.3 9.1.2 9.1.1 9.1.0 9.0.3 9.0.2 9.0.1 9.0.0 8.5.79 8.5.78 8.5.77 8.5.76 8.5.75 8.5.74 8.5.73 8.5.72 8.5.71 8.5.70 8.5.69 8.5.68 8.5.35 8.5.36 8.5.37 8.5.38 8.5.39 All 222 releases
← All changes | vendor/posthog/posthog-php/test/MockedHttpClient.php +4 -42 8.5.379.1.3 View file →
@@ -1,57 +1,19 @@
1 1 <?php
2 2
3 3 namespace PostHog\Test;
4 4
5 -use Closure;
6 5 use PostHog\HttpResponse;
7 6 use PostHog\Test\Assets\MockedResponses;
8 7
9 8 class MockedHttpClient extends \PostHog\HttpClient
10 9 {
11 - public $calls;
12 -
13 - private $flagEndpointResponse;
14 - private $flagsEndpointResponse;
15 -
16 - public function __construct(
17 - string $host,
18 - bool $useSsl = true,
19 - int $maximumBackoffDuration = 10000,
20 - bool $compressRequests = false,
21 - bool $debug = false,
22 - ?Closure $errorHandler = null,
23 - int $curlTimeoutMilliseconds = 750,
24 - array $flagEndpointResponse = [],
25 - array $flagsEndpointResponse = []
26 - ) {
27 - parent::__construct(
28 - $host,
29 - $useSsl,
30 - $maximumBackoffDuration,
31 - $compressRequests,
32 - $debug,
33 - $errorHandler,
34 - $curlTimeoutMilliseconds
35 - );
36 - $this->flagEndpointResponse = $flagEndpointResponse;
37 - $this->flagsEndpointResponse = !empty($flagsEndpointResponse) ? $flagsEndpointResponse : MockedResponses::FLAGS_REQUEST;
38 - }
39 -
40 - public function sendRequest(string $path, ?string $payload, array $extraHeaders = [], array $requestOptions = []): HttpResponse
10 + public function sendRequest(string $path, ?string $payload, array $extraHeaders = []): HttpResponse
41 11 {
42 12 if (!isset($this->calls)) {
43 - $this->calls = [];
13 + $this->calls = array();
44 14 }
45 - array_push($this->calls, array("path" => $path, "payload" => $payload, "extraHeaders" => $extraHeaders, "requestOptions" => $requestOptions));
15 + array_push($this->calls, array("path" => $path, "payload" => $payload));
46 16
47 - if (str_starts_with($path, "/flags/")) {
48 - return new HttpResponse(json_encode($this->flagsEndpointResponse), 200);
49 - }
50 -
51 - if (str_starts_with($path, "/api/feature_flag/local_evaluation")) {
52 - return new HttpResponse(json_encode($this->flagEndpointResponse), 200);
53 - }
54 -
55 - return parent::sendRequest($path, $payload, $extraHeaders, $requestOptions);
17 + return parent::sendRequest($path, $payload, $extraHeaders);
56 18 }
57 19 }