Skip to content

Commit

Permalink
bug fix Pdp\Exception inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed May 22, 2018
1 parent 5b954b1 commit 6945b8a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -2,7 +2,7 @@

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

## Next - TBD
## 5.3.0 - 2018-05-22

### Added

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

### Deprecated

Expand Down
17 changes: 12 additions & 5 deletions README.md
Expand Up @@ -51,6 +51,7 @@ Usage
use Pdp\Cache;
use Pdp\CurlHttpClient;
use Pdp\Manager;
use Pdp\Rules;

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


$altDomain = $rules->getPublicSuffix('thephpleague.github.io'); //$altDomain is a Pdp\PublicSuffix object
echo $altDomain->getContent(); // 'github.io'
$altDomain->isKnown(); // returns true
$altDomain->isICANN(); // returns false
$altDomain->isPrivate(); // returns true
$publicSuffix = $rules->getPublicSuffix('mydomain.github.io', Rules::PRIVATE_DOMAINS); //$publicSuffix is a Pdp\PublicSuffix object
echo $publicSuffix->getContent(); // 'github.io'
$publicSuffix->isKnown(); // returns true
$publicSuffix->isICANN(); // returns false
$publicSuffix->isPrivate(); // returns true

$altSuffix = $rules->getPublicSuffix('mydomain.github.io', Rules::ICANN_DOMAINS);
echo $altSuffix->getContent(); // 'io'
$altSuffix->isKnown(); // returns true
$altSuffix->isICANN(); // returns true
$altSuffix->isPrivate(); // returns false
~~~

Using the above code you have parse, validate and resolve a domain name and its public suffix status against the Public Suffix list.
Expand Down
4 changes: 2 additions & 2 deletions src/Exception.php
Expand Up @@ -15,8 +15,8 @@

namespace Pdp;

use RuntimeException;
use InvalidArgumentException;

class Exception extends RuntimeException
class Exception extends InvalidArgumentException
{
}

0 comments on commit 6945b8a

Please sign in to comment.