src/PublicSuffixList.php
protected function buildSubDomain(&$node, $tldParts)
    {
        $dom = trim(array_pop($tldParts));

        $isNotDomain = false;
        if ($this->startsWith($dom, "!")) {
            $dom = substr($dom, 1);
            $isNotDomain = true;
        }

        if (!array_key_exists($dom, $node)) {
            if ($isNotDomain) {
                $node[$dom] = array("!" => "");
            } else {
                $node[$dom] = array();
            }
        }

        if (!$isNotDomain && count($tldParts) > 0) {
            $this->buildSubDomain($node[$dom], $tldParts);
        }
    }
protected function buildSubDomain(&$node, $tldParts)
    {
        $dom = trim(array_pop($tldParts));

        $isNotDomain = false;
        if ($this->startsWith($dom, "!")) {
            $dom = substr($dom, 1);
            $isNotDomain = true;
        }

        if (!array_key_exists($dom, $node)) {
            if ($isNotDomain) {
                $node[$dom] = array("!" => "");
            } else {
                $node[$dom] = array();
            }
        }

        if (!$isNotDomain && count($tldParts) > 0) {
            $this->buildSubDomain($node[$dom], $tldParts);
        }
    }
protected function buildSubDomain ( & $ node , $ tldParts ) { $ dom = trim ( array_pop ( $ tldParts ) ) ; $ isNotDomain = false ; if ( $ this -> startsWith ( $ dom , "!" ) ) { $ dom = substr ( $ dom , 1 ) ; $ isNotDomain = true ; } if ( ! array_key_exists ( $ dom , $ node ) ) { if ( $ isNotDomain ) { $ node [ $ dom ] = array ( "!" => "" ) ; } else { $ node [ $ dom ] = array ( ) ; } } if ( ! $ isNotDomain && count ( $ tldParts ) > 0 ) { $ this -> buildSubDomain ( $ node [ $ dom ] , $ tldParts ) ; } }
Add domains to tree

@param array    $node     tree array by reference
@param string[] $tldParts array of domain parts

@return void - changes made to $node by reference
Add domains to tree