Code Duplication    Length = 8-10 lines in 2 locations

src/Validator/Validator.php 2 locations

@@ 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-59 (lines=10) @@
47
    /**
48
     * @throws \Psr\Http\Client\ClientExceptionInterface
49
     */
50
    public function validateContent(string $content): ValidationResponseInterface
51
    {
52
        $headers = [
53
            'body' => $content,
54
        ];
55
        $request = new Request('POST', self::CLOUDFLARE_AMP_VALIDATOR_ENDPOINT, $headers);
56
        $response = $this->httpClient->sendRequest($request);
57
58
        return $this->responseFactory->create($response);
59
    }
60
61
    private function normaliseUrl(string $url): string
62
    {