| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 47 | public function run() |
||
| 48 | { |
||
| 49 | try { |
||
| 50 | $certificate = $this->downloader->usingPort($this->port)->forHost($this->hostname); |
||
| 51 | } catch (InvalidUrl $urlException) { |
||
| 52 | throw new CheckerHasFailed("Could not check the Ssl Certificate for \"{$this->hostname}\": {$urlException->getMessage()}"); |
||
| 53 | } catch (CouldNotDownloadCertificate $downloadException) { |
||
| 54 | throw new CheckerHasFailed("Could not download the Ssl Certificate for \"{$this->hostname}\": {$downloadException->getMessage()}"); |
||
| 55 | } |
||
| 56 | |||
| 57 | if ($certificate->isValid()) { |
||
| 58 | return; |
||
| 59 | } |
||
| 60 | |||
| 61 | throw new CheckerHasFailed("The Ssl Certificate for \"{$this->hostname}\" is not valid. The expiration date is {$certificate->expirationDate()}."); |
||
| 62 | } |
||
| 63 | } |
||
| 64 |