@@ 38-45 (lines=8) @@ | ||
35 | /** |
|
36 | * @throws \Psr\Http\Client\ClientExceptionInterface |
|
37 | */ |
|
38 | public function validateUrl(string $url): ValidationResponseInterface |
|
39 | { |
|
40 | $url = $this->normaliseUrl($url); |
|
41 | $request = new Request('GET', self::CLOUDFLARE_AMP_VALIDATOR_ENDPOINT . $url); |
|
42 | $response = $this->httpClient->sendRequest($request); |
|
43 | ||
44 | return $this->responseFactory->create($response); |
|
45 | } |
|
46 | ||
47 | /** |
|
48 | * @throws \Psr\Http\Client\ClientExceptionInterface |
|
@@ 50-56 (lines=7) @@ | ||
47 | /** |
|
48 | * @throws \Psr\Http\Client\ClientExceptionInterface |
|
49 | */ |
|
50 | public function validateContent(string $content): ValidationResponseInterface |
|
51 | { |
|
52 | $request = new Request('POST', self::CLOUDFLARE_AMP_VALIDATOR_ENDPOINT, [], $content); |
|
53 | $response = $this->httpClient->sendRequest($request); |
|
54 | ||
55 | return $this->responseFactory->create($response); |
|
56 | } |
|
57 | ||
58 | private function normaliseUrl(string $url): string |
|
59 | { |