Methods |
public
|
__construct(string|null $url = null)
PublicSuffixList constructor.
PublicSuffixList constructor.
Parameters
$url |
URL for the PSL or null to use default
|
|
#
|
public
|
setURL(string|null $url): void
Set the URL, and clear any existing tree
Set the URL, and clear any existing tree
Parameters
$url |
URL for the PSL or null to use default
|
|
#
|
protected
|
setFallbackURL(): void
Set a fallback (default) for the URL. If we have a locally saved version, prefer it, but use a
remote URL if there is…
Set a fallback (default) for the URL. If we have a locally saved version, prefer it, but use a
remote URL if there is no local source.
|
#
|
protected
|
loadTree(): void
load the PSL tree, automatically handling caches
load the PSL tree, automatically handling caches
Returns
Throws
|
#
|
protected
|
parsePSL(string $fileData): void
Parse the PSL data
|
#
|
protected
|
startsWith(string $search, string $startString): bool
Does $search start with $startString?
Does $search start with $startString?
Parameters
$search |
the string to test
|
$startString |
the starting string to match
|
|
#
|
protected
|
buildSubDomain(array &$node, string[] $tldParts): void
Add domains to tree
Parameters
$node |
tree array by reference
|
$tldParts |
array of domain parts
|
Returns
- changes made to $node by reference
|
#
|
public
|
getTree(): array
Return the current tree, loading it if needed
Return the current tree, loading it if needed
Returns
Throws
|
#
|
protected
|
readPSL(): string|false
Read PSL from the URL or file specified in $this->url.
If we process a remote URL, save a local copy.
Read PSL from the URL or file specified in $this->url.
If we process a remote URL, save a local copy.
Returns
PSL file contents or false on error
|
#
|
protected
|
getCacheFileName(string $url): string
Determine cache file name for a specified source
Determine cache file name for a specified source
Parameters
$url |
URL/filename of source PSL
|
Returns
cache file name for given resource
|
#
|
protected
|
readCachedPSL(string $url): false|string[]
Attempt to load a cached Public Suffix List tree for a given source
Attempt to load a cached Public Suffix List tree for a given source
Parameters
$url |
URL/filename of source PSL
|
Returns
|
#
|
protected
|
cachePSL(string $url): bool|int
Cache the current Public Suffix List tree and associate with the specified source
Cache the current Public Suffix List tree and associate with the specified source
Parameters
$url |
URL/filename of source PSL
|
Returns
the number of bytes that were written to the file, or false on failure
|
#
|
protected
|
saveLocalPSL(string $fileContents): bool|int
Save a local copy of a retrieved Public Suffix List
Save a local copy of a retrieved Public Suffix List
Parameters
$fileContents |
URL/filename of source PSL
|
Returns
the number of bytes that were written to the file, or false on failure
|
#
|
protected
|
setLocalPSLName(null|string $url): void
Set localPSL name based on URL
Set localPSL name based on URL
Parameters
Returns
|
#
|
public
|
clearDataDirectory(bool $cacheOnly = false): void
Delete files in the data directory
Delete files in the data directory
Parameters
$cacheOnly |
true to limit clearing to cached serialized PSLs, false to clear all
|
|
#
|