Total Complexity | 5 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class UrlCheck extends AbstractCheck |
||
10 | { |
||
11 | |||
12 | protected $url; |
||
13 | |||
14 | /** |
||
15 | * @var Client |
||
16 | */ |
||
17 | protected $client; |
||
18 | |||
19 | /** |
||
20 | * UrlCheck constructor. |
||
21 | * |
||
22 | * @param string $label Label |
||
23 | * @param string $url URL to be tested |
||
24 | */ |
||
25 | public function __construct(string $label, string $url) |
||
26 | { |
||
27 | parent::__construct($label); |
||
28 | $this->url = $url; |
||
29 | $this->setHttpClient(new Client()); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * set http client |
||
34 | * |
||
35 | * @param Client $client |
||
36 | */ |
||
37 | public function setHttpClient(Client $client): void |
||
38 | { |
||
39 | $this->client = $client; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Check URL |
||
44 | * |
||
45 | * @return Result |
||
46 | * @throws GuzzleException |
||
47 | */ |
||
48 | public function checkStatus(): Result |
||
60 | } |
||
61 | } |
||
62 |