Overview

Namespaces

  • Composer
    • Autoload
  • Geekwright
    • RegDom
  • League
    • OAuth2
      • Client
        • Provider
  • None
  • Xmf
    • Database
    • Jwt
    • Key
    • Module
      • Helper

Classes

  • PublicSuffixList
  • RegisteredDomain
  • Overview
  • Namespace
  • Class
  • Tree

Class PublicSuffixList

Manage the Public Suffix List (PSL) data. This includes, downloading, converting to an array tree structure for access in PHP, and caching the results.

Namespace: Geekwright\RegDom
Package: Geekwright\RegDom
License: License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
Author: Florian Sager, 06.08.2008, sager@agitos.de
Author: Marcus Bointon (https://github.com/Synchro/regdom-php)
Author: Richard Griffith richard@geekwright.com
Located at lass/libraries/vendor/geekwright/regdom/src/PublicSuffixList.php
Methods summary
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 )

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( )

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.

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( )

load the PSL tree, automatically handling caches

load the PSL tree, automatically handling caches

Returns


(results in $this->tree)

Throws

RuntimeException
protected
# parsePSL( string $fileData )

Parse the PSL data

Parse the PSL data

Parameters

$fileData
the PSL data

Returns


(results in $this->tree)
protected boolean
# startsWith( string $search, string $startString )

Does $search start with $startString?

Does $search start with $startString?

Parameters

$search
the string to test
$startString
the starting string to match

Returns

boolean
protected
# buildSubDomain( array & $node, string[] $tldParts )

Add domains to tree

Add domains to tree

Parameters

$node
tree array by reference
$tldParts
array of domain parts

Returns


  • changes made to $node by reference
public array
# getTree( )

Return the current tree, loading it if needed

Return the current tree, loading it if needed

Returns

array
the PSL tree
protected boolean|string
# readPSL( )

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

boolean|string
PSL file contents or false on error
protected string
# getCacheFileName( string $url )

Determine cache file name for a specified source

Determine cache file name for a specified source

Parameters

$url
URL/filename of source PSL

Returns

string
cache file name for given resource
protected boolean|string[]
# readCachedPSL( string $url )

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

boolean|string[]
PSL tree
protected boolean|integer
# cachePSL( string $url )

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

boolean|integer
the number of bytes that were written to the file, or false on failure
protected boolean|integer
# saveLocalPSL( string $fileContents )

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

boolean|integer
the number of bytes that were written to the file, or false on failure
protected
# setLocalPSLName( null|string $url )

Set localPSL name based on URL

Set localPSL name based on URL

Parameters

$url
the URL for the PSL

Returns


(sets $this->localPSL)
public
# clearDataDirectory( boolean $cacheOnly = false )

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
Properties summary
protected string $sourceURL
# 'https://publicsuffix.org/list/public_suffix_list.dat'
protected string $localPSL
# 'public_suffix_list.dat'
protected string $cachedPrefix
# 'cached_'
protected $tree
#
protected $url
#
protected string $dataDir
# '/../data/'
API documentation generated by ApiGen