Todaymade\Daux\Tree\Directory::seekFirstPage PHP Method

seekFirstPage() public method

Seek the first available page from descendants
public seekFirstPage ( ) : Todaymade\Daux\Tree\Content | null
return Todaymade\Daux\Tree\Content | null
    public function seekFirstPage()
    {
        if ($this instanceof self) {
            $index_key = $this->getConfig()['index_key'];
            if (isset($this->children[$index_key])) {
                return $this->children[$index_key];
            }
            foreach ($this->children as $node_key => $node) {
                if ($node instanceof Content) {
                    return $node;
                }
                if ($node instanceof self && strpos($node->getUri(), '.') !== 0 && ($childNode = $node->seekFirstPage())) {
                    return $childNode;
                }
            }
        }
        return null;
    }