src/Scope.php
protected function peridotScanChildren(Scope $scope, callable $fn, &$accumulator = [])
    {
        if (! empty($accumulator)) {
            return $accumulator;
        }

        $children = $scope->peridotGetChildScopes();
        foreach ($children as $childScope) {
            $fn($childScope, $accumulator);
            $this->peridotScanChildren($childScope, $fn, $accumulator);
        }

        if (empty($accumulator)) {
            return [null, false];
        }

        return $accumulator;
    }
protected function peridotScanChildren(Scope $scope, callable $fn, &$accumulator = [])
    {
        if (! empty($accumulator)) {
            return $accumulator;
        }

        $children = $scope->peridotGetChildScopes();
        foreach ($children as $childScope) {
            $fn($childScope, $accumulator);
            $this->peridotScanChildren($childScope, $fn, $accumulator);
        }

        if (empty($accumulator)) {
            return [null, false];
        }

        return $accumulator;
    }
protected function peridotScanChildren ( Scope $ scope , callable $ fn , & $ accumulator = [ ] ) { if ( ! empty ( $ accumulator ) ) { return $ accumulator ; } $ children = $ scope -> peridotGetChildScopes ( ) ; foreach ( $ children as $ childScope ) { $ fn ( $ childScope , $ accumulator ) ; $ this -> peridotScanChildren ( $ childScope , $ fn , $ accumulator ) ; } if ( empty ( $ accumulator ) ) { return [ null , false ] ; } return $ accumulator ; }
Scan child scopes and execute a function against each one passing an
accumulator reference along.

@param Scope $scope
@param callable $fn
@param array $accumulator
@return array
Scan child scopes and execute a function against each one passing an accumulator reference along .