src/Mmi/Navigation/NavigationConfig.php
protected function _findInChildren(array $element, $id, $withParents, array &$parents)
    {
        if ($element['id'] == $id) {
            return $element;
        }
        foreach ($element['children'] as $child) {
            if ($child['id'] == $id) {
                if ($withParents) {
                    $parents[] = $element;
                }
                return $child;
            }
            if (null !== ($found = $this->_findInChildren($child, $id, $withParents, $parents))) {
                if ($withParents) {
                    $parents[] = $element;
                }
                return $found;
            }
        }
    }
protected function _findInChildren(array $element, $id, $withParents, array &$parents)
    {
        if ($element['id'] == $id) {
            return $element;
        }
        foreach ($element['children'] as $child) {
            if ($child['id'] == $id) {
                if ($withParents) {
                    $parents[] = $element;
                }
                return $child;
            }
            if (null !== ($found = $this->_findInChildren($child, $id, $withParents, $parents))) {
                if ($withParents) {
                    $parents[] = $element;
                }
                return $found;
            }
        }
    }
protected function _findInChildren ( array $ element , $ id , $ withParents , array & $ parents ) { if ( $ element [ 'id' ] == $ id ) { return $ element ; } foreach ( $ element [ 'children' ] as $ child ) { if ( $ child [ 'id' ] == $ id ) { if ( $ withParents ) { $ parents [ ] = $ element ; } return $ child ; } if ( null !== ( $ found = $ this -> _findInChildren ( $ child , $ id , $ withParents , $ parents ) ) ) { if ( $ withParents ) { $ parents [ ] = $ element ; } return $ found ; } } }
Rekurencyjnie przeszukuje elementy potomne
@param $element
@param int $id identyfikator
@return array
Rekurencyjnie przeszukuje elementy potomne