private function applyWorkers(AssetCollectionInterface $asset)
    {
        foreach ($asset as $leaf) {
            foreach ($this->workers as $worker) {
                $retval = $worker->process($leaf, $this);

                if ($retval instanceof AssetInterface && $leaf !== $retval) {
                    $asset->replaceLeaf($leaf, $retval);
                }
            }
        }

        foreach ($this->workers as $worker) {
            $retval = $worker->process($asset, $this);

            if ($retval instanceof AssetInterface) {
                $asset = $retval;
            }
        }

        return $asset instanceof AssetCollectionInterface ? $asset : $this->createAssetCollection(array($asset));
    }
private function applyWorkers(AssetCollectionInterface $asset)
    {
        foreach ($asset as $leaf) {
            foreach ($this->workers as $worker) {
                $retval = $worker->process($leaf, $this);

                if ($retval instanceof AssetInterface && $leaf !== $retval) {
                    $asset->replaceLeaf($leaf, $retval);
                }
            }
        }

        foreach ($this->workers as $worker) {
            $retval = $worker->process($asset, $this);

            if ($retval instanceof AssetInterface) {
                $asset = $retval;
            }
        }

        return $asset instanceof AssetCollectionInterface ? $asset : $this->createAssetCollection(array($asset));
    }
private function applyWorkers ( AssetCollectionInterface $ asset ) { foreach ( $ asset as $ leaf ) { foreach ( $ this -> workers as $ worker ) { $ retval = $ worker -> process ( $ leaf , $ this ) ; if ( $ retval instanceof AssetInterface && $ leaf !== $ retval ) { $ asset -> replaceLeaf ( $ leaf , $ retval ) ; } } } foreach ( $ this -> workers as $ worker ) { $ retval = $ worker -> process ( $ asset , $ this ) ; if ( $ retval instanceof AssetInterface ) { $ asset = $ retval ; } } return $ asset instanceof AssetCollectionInterface ? $ asset : $ this -> createAssetCollection ( array ( $ asset ) ) ; }
Filters an asset collection through the factory workers.

Each leaf asset will be processed first, followed by the asset
collection itself.

@param AssetCollectionInterface $asset An asset collection

@return AssetCollectionInterface
Filters an asset collection through the factory workers .