private function addLayersToStack($layers, &$stack)
    {
        foreach ($layers as $layer) {
            if ($layer instanceof LayerGroup) {
                $this->addLayersToStack($layer->getLayers(), $stack);
            }

            $stack[] = $layer;
        }
    }
private function addLayersToStack($layers, &$stack)
    {
        foreach ($layers as $layer) {
            if ($layer instanceof LayerGroup) {
                $this->addLayersToStack($layer->getLayers(), $stack);
            }

            $stack[] = $layer;
        }
    }
private function addLayersToStack ( $ layers , & $ stack ) { foreach ( $ layers as $ layer ) { if ( $ layer instanceof LayerGroup ) { $ this -> addLayersToStack ( $ layer -> getLayers ( ) , $ stack ) ; } $ stack [ ] = $ layer ; } }
Add layers to to the stack.

@param array $layers The layers to be added.
@param array $stack  The object stack being built.

@return void
Add layers to to the stack .