src/RegisteredDomain.php
protected function findRegisteredDomain($remainingSigningDomainParts, &$treeNode)
    {
        $sub = array_pop($remainingSigningDomainParts);

        $result = null;
        if (isset($treeNode['!'])) {
            return '';
        } elseif (is_array($treeNode) && array_key_exists($sub, $treeNode)) {
            $result = $this->findRegisteredDomain($remainingSigningDomainParts, $treeNode[$sub]);
        } elseif (is_array($treeNode) && array_key_exists('*', $treeNode)) {
            $result = $this->findRegisteredDomain($remainingSigningDomainParts, $treeNode['*']);
        } else {
            return $sub;
        }

        if ($result === '') {
            return $sub;
        } elseif (strlen($result)>0) {
            return $result . '.' . $sub;
        }
        return null;
    }
protected function findRegisteredDomain($remainingSigningDomainParts, &$treeNode)
    {
        $sub = array_pop($remainingSigningDomainParts);

        $result = null;
        if (isset($treeNode['!'])) {
            return '';
        } elseif (is_array($treeNode) && array_key_exists($sub, $treeNode)) {
            $result = $this->findRegisteredDomain($remainingSigningDomainParts, $treeNode[$sub]);
        } elseif (is_array($treeNode) && array_key_exists('*', $treeNode)) {
            $result = $this->findRegisteredDomain($remainingSigningDomainParts, $treeNode['*']);
        } else {
            return $sub;
        }

        if ($result === '') {
            return $sub;
        } elseif (strlen($result)>0) {
            return $result . '.' . $sub;
        }
        return null;
    }
protected function findRegisteredDomain ( $ remainingSigningDomainParts , & $ treeNode ) { $ sub = array_pop ( $ remainingSigningDomainParts ) ; $ result = null ; if ( isset ( $ treeNode [ '!' ] ) ) { return '' ; } elseif ( is_array ( $ treeNode ) && array_key_exists ( $ sub , $ treeNode ) ) { $ result = $ this -> findRegisteredDomain ( $ remainingSigningDomainParts , $ treeNode [ $ sub ] ) ; } elseif ( is_array ( $ treeNode ) && array_key_exists ( '*' , $ treeNode ) ) { $ result = $ this -> findRegisteredDomain ( $ remainingSigningDomainParts , $ treeNode [ '*' ] ) ; } else { return $ sub ; } if ( $ result === '' ) { return $ sub ; } elseif ( strlen ( $ result ) > 0 ) { return $ result . '.' . $ sub ; } return null ; }
Recursive helper method to query the PSL tree

@param string[] $remainingSigningDomainParts parts of domain being queried
@param string[] $treeNode                    subset of tree array by reference

@return null|string
Recursive helper method to query the PSL tree