| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | public function run() |
||
| 40 | { |
||
| 41 | try { |
||
| 42 | $certificate = $this->downloader->usingPort($this->port)->forHost($this->hostname); |
||
| 43 | } catch (InvalidUrl $urlException) { |
||
| 44 | throw new CheckerHasFailed("Could not check the Ssl Certificate for \"{$this->hostname}\": {$urlException->getMessage()}"); |
||
| 45 | } catch (CouldNotDownloadCertificate $downloadException) { |
||
| 46 | throw new CheckerHasFailed("Could not download the Ssl Certificate for \"{$this->hostname}\": {$downloadException->getMessage()}"); |
||
| 47 | } |
||
| 48 | |||
| 49 | if ($certificate->isValid()) { |
||
| 50 | return; |
||
| 51 | } |
||
| 52 | |||
| 53 | throw new CheckerHasFailed("The Ssl Certificate for \"{$this->hostname}\" is not valid. The expiration date is {$certificate->expirationDate()}."); |
||
| 54 | } |
||
| 55 | } |
||
| 56 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: