Skip to content

Commit 79b0500

Browse files
committed
Improve documentation
1 parent 7e2855d commit 79b0500

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

README.md

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function Domain::isPrivate(): bool;
9898

9999
*The getter methods return normalized and lowercased domain labels or `null` if no value was found for a particular domain part.*
100100

101-
The `Pdp\Domain` object also implements PHP's `Countable`, `IteratorAggregate` and `JsonSerializable` interfaces to ease retrieving the object properties.
101+
The `Pdp\Domain` object also implements PHP's `Countable`, `IteratorAggregate` and `JsonSerializable` interfaces to ease retrieving the domain labels and properties.
102102

103103
Once you have a `Pdp\Domain` object you can also modify its content using the following methods:
104104

@@ -129,7 +129,7 @@ $newDomain->isKnown(); //return false;
129129

130130
**WARNING: in the example above the public suffix informations are lost because the newly attached public suffix had none.**
131131

132-
To avoid this data loss you should use an already resolved public suffix.
132+
To avoid this data loss you should use a `Pdp\PublicSuffix` object instead.
133133

134134
~~~php
135135
$domain = $rules->resolve('www.bbc.co.uk');
@@ -149,7 +149,7 @@ The `Pdp\PublicSuffix` is an immutable value object which exposes the same metho
149149
- all the modifying methods, **`toAscii` and `toUnicode` excluded**.
150150
- `getPublicSuffix`, `getRegistrableDomain`, `getSubDomain`, `isResolvable`
151151

152-
### Public suffix information resolution.
152+
### Public suffix resolution.
153153

154154
~~~php
155155
<?php
@@ -184,12 +184,8 @@ By default, the `$section` argument is equal to the empty string. If an unsuppor
184184
**THIS EXAMPLE ILLUSTRATES HOW THE OBJECT WORK BUT SHOULD BE AVOIDED IN PRODUCTON**
185185

186186
~~~php
187-
<?php
188-
189-
use Pdp\Rules;
190-
191187
$pdp_url = 'https://raw.githubusercontent.com/publicsuffix/list/master/public_suffix_list.dat';
192-
$rules = Rules::createFromPath($pdp_url);
188+
$rules = Pdp\Rules::createFromPath($pdp_url);
193189

194190
$domain = $rules->resolve('www.Ulb.AC.be'); // resolution is done against all the sections available
195191
echo $domain; // returns www.ulb.ac.be
@@ -301,13 +297,7 @@ The `Pdp\Manager::refreshRules` method enables refreshing your local copy of the
301297
The method returns a boolean value which is `true` on success.
302298

303299
~~~php
304-
<?php
305-
306-
use Pdp\Cache;
307-
use Pdp\CurlHttpClient;
308-
use Pdp\Manager;
309-
310-
$manager = new Manager(new Cache(), new CurlHttpClient());
300+
$manager = new Pdp\Manager(new Pdp\Cache(), new Pdp\CurlHttpClient());
311301
$retval = $manager->refreshRules('https://publicsuffix.org/list/public_suffix_list.dat');
312302
if ($retval) {
313303
//the local cache has been updated
@@ -338,11 +328,7 @@ On error, the method throws an `Pdp\Exception`.
338328
~~~php
339329
<?php
340330

341-
use Pdp\Cache;
342-
use Pdp\CurlHttpClient;
343-
use Pdp\Manager;
344-
345-
$manager = new Manager(new Cache(), new CurlHttpClient());
331+
$manager = new Pdp\Manager(new Pdp\Cache(), new Pdp\CurlHttpClient());
346332
$rules = $manager->getRules('https://raw.githubusercontent.com/publicsuffix/list/master/public_suffix_list.dat');
347333
$domain = $rules->resolve('www.ulb.ac.be');
348334
echo $domain->getPublicSuffix(); // print 'ac.be'

0 commit comments

Comments
 (0)