Skip to content

Commit 6945b8a

Browse files
committed
bug fix Pdp\Exception inheritance
1 parent 5b954b1 commit 6945b8a

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All Notable changes to `PHP Domain Parser` **5.x** series will be documented in this file
44

5-
## Next - TBD
5+
## 5.3.0 - 2018-05-22
66

77
### Added
88

@@ -26,6 +26,7 @@ All Notable changes to `PHP Domain Parser` **5.x** series will be documented in
2626
- `Pdp\Domain` and `Pdp\PublicSuffix` host validation compliance to RFC improved
2727
- Improve `Pdp\Converter` and `Pdp\Manager` class to better report error on IDN conversion.
2828
- Improve `Pdp\Installer` vendor directory resolution see [PR #222](https://github.com/jeremykendall/php-domain-parser/pull/222)
29+
- `Pdp\Exception` nows extends `InvalidArgumentException` instead of `RuntimeException`
2930

3031
### Deprecated
3132

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Usage
5151
use Pdp\Cache;
5252
use Pdp\CurlHttpClient;
5353
use Pdp\Manager;
54+
use Pdp\Rules;
5455

5556
$manager = new Manager(new Cache(), new CurlHttpClient());
5657
$rules = $manager->getRules(); //$rules is a Pdp\Rules object
@@ -66,11 +67,17 @@ $domain->isICANN(); // returns true
6667
$domain->isPrivate(); // returns false
6768

6869

69-
$altDomain = $rules->getPublicSuffix('thephpleague.github.io'); //$altDomain is a Pdp\PublicSuffix object
70-
echo $altDomain->getContent(); // 'github.io'
71-
$altDomain->isKnown(); // returns true
72-
$altDomain->isICANN(); // returns false
73-
$altDomain->isPrivate(); // returns true
70+
$publicSuffix = $rules->getPublicSuffix('mydomain.github.io', Rules::PRIVATE_DOMAINS); //$publicSuffix is a Pdp\PublicSuffix object
71+
echo $publicSuffix->getContent(); // 'github.io'
72+
$publicSuffix->isKnown(); // returns true
73+
$publicSuffix->isICANN(); // returns false
74+
$publicSuffix->isPrivate(); // returns true
75+
76+
$altSuffix = $rules->getPublicSuffix('mydomain.github.io', Rules::ICANN_DOMAINS);
77+
echo $altSuffix->getContent(); // 'io'
78+
$altSuffix->isKnown(); // returns true
79+
$altSuffix->isICANN(); // returns true
80+
$altSuffix->isPrivate(); // returns false
7481
~~~
7582

7683
Using the above code you have parse, validate and resolve a domain name and its public suffix status against the Public Suffix list.

src/Exception.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
namespace Pdp;
1717

18-
use RuntimeException;
18+
use InvalidArgumentException;
1919

20-
class Exception extends RuntimeException
20+
class Exception extends InvalidArgumentException
2121
{
2222
}

0 commit comments

Comments
 (0)