Skip to content

Commit feed1cd

Browse files
committed
add ::labels documentation
1 parent 74b9293 commit feed1cd

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

README.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,13 @@ $domain->isResolvable(); // returns true
6565
$domain->isKnown(); // returns true
6666
$domain->isICANN(); // returns true
6767
$domain->isPrivate(); // returns false
68-
68+
$domain->labels(); // returns ['be', 'ac', 'ulb', 'www']
6969
$publicSuffix = $rules->getPublicSuffix('mydomain.github.io', Rules::PRIVATE_DOMAINS); //$publicSuffix is a Pdp\PublicSuffix object
7070
echo $publicSuffix->getContent(); // 'github.io'
7171
$publicSuffix->isKnown(); // returns true
7272
$publicSuffix->isICANN(); // returns false
7373
$publicSuffix->isPrivate(); // returns true
74+
$publicSuffix->labels(); // returns ['io', 'github']
7475

7576
$altSuffix = $rules->getPublicSuffix('mydomain.github.io', Rules::ICANN_DOMAINS);
7677
echo $altSuffix->getContent(); // 'io'
@@ -142,6 +143,7 @@ $domain->isKnown(); // returns false
142143
$domain->isICANN(); // returns false
143144
$domain->isPrivate(); // returns false
144145
iterator_to_array($domain, false); // ['com', 'example', 'bébé', 'www']
146+
$domain->labels(); // ['com', 'example', 'bébé', 'www'] since v5.5
145147
$domain->toAscii()->getContent(); // www.xn--bb-bjab.example.com
146148
echo (new Domain('www.xn--bb-bjab.example.com'))->toAscii() // www.bébé.example.com
147149
~~~
@@ -348,9 +350,27 @@ namespace Pdp;
348350

349351
final class TopLevelDomains implements Countable, IteratorAggregate
350352
{
351-
public static function createFromPath(string $path, $context = null, int $asciiIDNAOption = IDNA_DEFAULT, int $unicodeIDNAOption = IDNA_DEFAULT): Rules
352-
public static function createFromString(string $content, int $asciiIDNAOption = IDNA_DEFAULT, int $unicodeIDNAOption = IDNA_DEFAULT): Rules
353-
public function __construct(array $records, string $version, DateTimeInterface $modifiedDate, int $asciiIDNAOption = IDNA_DEFAULT, int $unicodeIDNAOption = IDNA_DEFAULT)
353+
public static function createFromPath(
354+
string $path,
355+
$context = null,
356+
int $asciiIDNAOption = IDNA_DEFAULT,
357+
int $unicodeIDNAOption = IDNA_DEFAULT
358+
): TopLevelDomains
359+
360+
public static function createFromString(
361+
string $content,
362+
int $asciiIDNAOption = IDNA_DEFAULT,
363+
int $unicodeIDNAOption = IDNA_DEFAULT
364+
): TopLevelDomains
365+
366+
public function __construct(
367+
array $records,
368+
string $version,
369+
DateTimeInterface $modifiedDate,
370+
int $asciiIDNAOption = IDNA_DEFAULT,
371+
int $unicodeIDNAOption = IDNA_DEFAULT
372+
)
373+
354374
public function resolve($domain): Domain
355375
public function contains($domain): bool
356376
public function isEmpty(): bool

0 commit comments

Comments
 (0)