1 | <?php declare(strict_types=1); |
||
12 | class Validator implements ValidatorInterface |
||
13 | { |
||
14 | const CLOUDFLARE_AMP_VALIDATOR_ENDPOINT = 'https://amp.cloudflare.com/q/'; |
||
15 | |||
16 | /** |
||
17 | * @var ClientInterface |
||
18 | */ |
||
19 | private $httpClient; |
||
20 | |||
21 | /** |
||
22 | * @var ValidationResponseFactory |
||
23 | */ |
||
24 | private $responseFactory; |
||
25 | |||
26 | /** |
||
27 | * @var RequestFactoryInterface |
||
28 | */ |
||
29 | private $requestFactory; |
||
30 | |||
31 | public function __construct(ClientInterface $httpClient, ?RequestFactoryInterface $requestFactory = null) |
||
38 | |||
39 | public function setHttpClient(ClientInterface $httpClient) |
||
43 | |||
44 | /** |
||
45 | * @throws \Psr\Http\Client\ClientExceptionInterface |
||
46 | */ |
||
47 | public function validateUrl(string $url): ValidationResponseInterface |
||
55 | |||
56 | /** |
||
57 | * @throws \Psr\Http\Client\ClientExceptionInterface |
||
58 | */ |
||
59 | public function validateContent(string $content): ValidationResponseInterface |
||
68 | |||
69 | private function normaliseUrl(string $url): string |
||
73 | } |
||
74 |