FluidTYPO3\Vhs\Service\AssetService::buildAssetsChunk PHP Метод

buildAssetsChunk() защищенный Метод

protected buildAssetsChunk ( array $assets ) : string
$assets array
Результат string
    protected function buildAssetsChunk($assets)
    {
        $spool = [];
        foreach ($assets as $name => $asset) {
            $assetSettings = $this->extractAssetSettings($asset);
            $type = $assetSettings['type'];
            if (false === isset($spool[$type])) {
                $spool[$type] = [];
            }
            $spool[$type][$name] = $asset;
        }
        $chunks = [];
        foreach ($spool as $type => $spooledAssets) {
            $chunk = [];
            /** @var AssetInterface[] $spooledAssets */
            foreach ($spooledAssets as $name => $asset) {
                $assetSettings = $this->extractAssetSettings($asset);
                $standalone = (bool) $assetSettings['standalone'];
                $external = (bool) $assetSettings['external'];
                $rewrite = (bool) $assetSettings['rewrite'];
                $path = $assetSettings['path'];
                if (false === $standalone) {
                    $chunk[$name] = $asset;
                } else {
                    if (0 < count($chunk)) {
                        $mergedFileTag = $this->writeCachedMergedFileAndReturnTag($chunk, $type);
                        array_push($chunks, $mergedFileTag);
                        $chunk = [];
                    }
                    if (true === empty($path)) {
                        $assetContent = $this->extractAssetContent($asset);
                        array_push($chunks, $this->generateTagForAssetType($type, $assetContent));
                    } else {
                        if (true === $external) {
                            array_push($chunks, $this->generateTagForAssetType($type, null, $path));
                        } else {
                            if (true === $rewrite) {
                                array_push($chunks, $this->writeCachedMergedFileAndReturnTag(array($name => $asset), $type));
                            } else {
                                $integrity = $this->getFileIntegrity($path);
                                $path = substr($path, strlen(PATH_site));
                                $path = $this->prefixPath($path);
                                array_push($chunks, $this->generateTagForAssetType($type, null, $path, $integrity));
                            }
                        }
                    }
                }
                unset($integrity);
            }
            if (0 < count($chunk)) {
                $mergedFileTag = $this->writeCachedMergedFileAndReturnTag($chunk, $type);
                array_push($chunks, $mergedFileTag);
            }
        }
        return implode(LF, $chunks);
    }