public function findByAttribute(string $attribute, $value): array
    {
        $result = [];
        $iterator = new \RecursiveIteratorIterator($this, \RecursiveIteratorIterator::SELF_FIRST);

        /** @var Page $page */
        foreach ($iterator as $page) {
            if ($page->getAttribute($attribute) == $value) {
                $result[] = $page;
            }
        }
        return $result;
    }
public function findByAttribute(string $attribute, $value): array
    {
        $result = [];
        $iterator = new \RecursiveIteratorIterator($this, \RecursiveIteratorIterator::SELF_FIRST);

        /** @var Page $page */
        foreach ($iterator as $page) {
            if ($page->getAttribute($attribute) == $value) {
                $result[] = $page;
            }
        }
        return $result;
    }
public function findByAttribute ( string $ attribute , $ value ) : array { $ result = [ ] ; $ iterator = new \ RecursiveIteratorIterator ( $ this , \ RecursiveIteratorIterator :: SELF_FIRST ) ; /** @var Page $page */ foreach ( $ iterator as $ page ) { if ( $ page -> getAttribute ( $ attribute ) == $ value ) { $ result [ ] = $ page ; } } return $ result ; }
Find all children by attribute

@param string $attribute
@param mixed $value
@return array
Find all children by attribute