public function findOneByAttribute(string $attribute, $value): ?Page
    {
        $iterator = new \RecursiveIteratorIterator($this, \RecursiveIteratorIterator::SELF_FIRST);
        /** @var Page $page */
        foreach ($iterator as $page) {
            if ($page->getAttribute($attribute) === $value) {
                return $page;
            }
        }
        return null;
    }
public function findOneByAttribute(string $attribute, $value): ?Page
    {
        $iterator = new \RecursiveIteratorIterator($this, \RecursiveIteratorIterator::SELF_FIRST);
        /** @var Page $page */
        foreach ($iterator as $page) {
            if ($page->getAttribute($attribute) === $value) {
                return $page;
            }
        }
        return null;
    }
public function findOneByAttribute ( string $ attribute , $ value ) : ? Page { $ iterator = new \ RecursiveIteratorIterator ( $ this , \ RecursiveIteratorIterator :: SELF_FIRST ) ; /** @var Page $page */ foreach ( $ iterator as $ page ) { if ( $ page -> getAttribute ( $ attribute ) === $ value ) { return $ page ; } } return null ; }
Find a single child by attribute

@param string $attribute
@param mixed $value
@return Page|null
Find a single child by attribute