Skip to content

Commit

Permalink
add isSelfSigned
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Aug 25, 2017
1 parent d2eba28 commit 51c228c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to `ssl-certificate` will be documented in this file

## 1.8.0 - 2017-08-28

- add `isSelfSigned`

## 1.7.0 - 2017-08-28

- add `getDaysUntilExpirationDate`
Expand Down
5 changes: 5 additions & 0 deletions src/SslCertificate.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ public function isValid(string $url = null)
return true;
}

public function isSelfSigned(): bool
{
return $this->getIssuer() === $this->getDomain();
}

public function isValidUntil(Carbon $carbon, string $url = null): bool
{
if ($this->expirationDate()->lte($carbon)) {
Expand Down
6 changes: 6 additions & 0 deletions tests/SslCertificateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,10 @@ public function it_can_get_the_days_until_the_expiration_date()
{
$this->assertEquals(77, $this->certificate->daysUntilExpirationDate());
}

/** @test */
public function it_can_determine_if_it_is_self_signed()
{
$this->assertFalse($this->certificate->isSelfSigned());
}
}

0 comments on commit 51c228c

Please sign in to comment.