public function assetFiles(array $assets, array $options = []): string
    {
        $assets = $this->prepareAssets($assets);
        $options = array_replace_recursive($this->options, $options);

        $cacheKey = $this->getCacheKey($assets, $options);
        $cacheItem = $this->cache->getItem($cacheKey);
        if ($cacheItem->isHit()) {
            return $cacheItem->get();
        }

        $jsFiles = [];
        $cssFiles = [];
        foreach ($assets as $file) {
            $fileType = strtolower(pathinfo($file, PATHINFO_EXTENSION));
            if ($fileType === 'js') {
                $jsFiles[] = $file;
            }
            if ($fileType === 'css') {
                $cssFiles[] = $file;
            }
        }
        $cssContent = $this->css($cssFiles, $options);
        $jsContent = $this->js($jsFiles, $options);
        $result = $cssContent . $jsContent;

        $cacheItem->set($result);
        $this->cache->save($cacheItem);

        return $result;
    }
public function assetFiles(array $assets, array $options = []): string
    {
        $assets = $this->prepareAssets($assets);
        $options = array_replace_recursive($this->options, $options);

        $cacheKey = $this->getCacheKey($assets, $options);
        $cacheItem = $this->cache->getItem($cacheKey);
        if ($cacheItem->isHit()) {
            return $cacheItem->get();
        }

        $jsFiles = [];
        $cssFiles = [];
        foreach ($assets as $file) {
            $fileType = strtolower(pathinfo($file, PATHINFO_EXTENSION));
            if ($fileType === 'js') {
                $jsFiles[] = $file;
            }
            if ($fileType === 'css') {
                $cssFiles[] = $file;
            }
        }
        $cssContent = $this->css($cssFiles, $options);
        $jsContent = $this->js($jsFiles, $options);
        $result = $cssContent . $jsContent;

        $cacheItem->set($result);
        $this->cache->save($cacheItem);

        return $result;
    }
public function assetFiles ( array $ assets , array $ options = [ ] ) : string { $ assets = $ this -> prepareAssets ( $ assets ) ; $ options = array_replace_recursive ( $ this -> options , $ options ) ; $ cacheKey = $ this -> getCacheKey ( $ assets , $ options ) ; $ cacheItem = $ this -> cache -> getItem ( $ cacheKey ) ; if ( $ cacheItem -> isHit ( ) ) { return $ cacheItem -> get ( ) ; } $ jsFiles = [ ] ; $ cssFiles = [ ] ; foreach ( $ assets as $ file ) { $ fileType = strtolower ( pathinfo ( $ file , PATHINFO_EXTENSION ) ) ; if ( $ fileType === 'js' ) { $ jsFiles [ ] = $ file ; } if ( $ fileType === 'css' ) { $ cssFiles [ ] = $ file ; } } $ cssContent = $ this -> css ( $ cssFiles , $ options ) ; $ jsContent = $ this -> js ( $ jsFiles , $ options ) ; $ result = $ cssContent . $ jsContent ; $ cacheItem -> set ( $ result ) ; $ this -> cache -> save ( $ cacheItem ) ; return $ result ; }
Render and compress JavaScript assets.

@param array $assets
@param array $options

@return string content
Render and compress JavaScript assets .