protected function prepareAssets(array $assets)
    {
        if (!is_array($assets)) {
            $assets = [$assets];
        }

        /*
         * Split assets in to groups.
         */
        $combineJs = [];
        $combineCss = [];

        foreach ($assets as $asset) {
            /*
             * Allow aliases to go through without an extension
             */
            if (substr($asset, 0, 1) == '@') {
                $combineJs[] = $asset;
                $combineCss[] = $asset;
                continue;
            }

            $extension = File::extension($asset);

            if (in_array($extension, self::$jsExtensions)) {
                $combineJs[] = $asset;
                continue;
            }

            if (in_array($extension, self::$cssExtensions)) {
                $combineCss[] = $asset;
                continue;
            }
        }

        /*
         * Determine which group of assets to combine.
         */
        if (count($combineCss) > count($combineJs)) {
            $extension = 'css';
            $assets = $combineCss;
        }
        else {
            $extension = 'js';
            $assets = $combineJs;
        }

        /*
         * Apply registered aliases
         */
        if ($aliasMap = $this->getAliases($extension)) {
            foreach ($assets as $key => $asset) {
                if (substr($asset, 0, 1) !== '@') {
                    continue;
                }
                $_asset = substr($asset, 1);

                if (isset($aliasMap[$_asset])) {
                    $assets[$key] = $aliasMap[$_asset];
                }
            }
        }

        return [$assets, $extension];
    }
protected function prepareAssets(array $assets)
    {
        if (!is_array($assets)) {
            $assets = [$assets];
        }

        /*
         * Split assets in to groups.
         */
        $combineJs = [];
        $combineCss = [];

        foreach ($assets as $asset) {
            /*
             * Allow aliases to go through without an extension
             */
            if (substr($asset, 0, 1) == '@') {
                $combineJs[] = $asset;
                $combineCss[] = $asset;
                continue;
            }

            $extension = File::extension($asset);

            if (in_array($extension, self::$jsExtensions)) {
                $combineJs[] = $asset;
                continue;
            }

            if (in_array($extension, self::$cssExtensions)) {
                $combineCss[] = $asset;
                continue;
            }
        }

        /*
         * Determine which group of assets to combine.
         */
        if (count($combineCss) > count($combineJs)) {
            $extension = 'css';
            $assets = $combineCss;
        }
        else {
            $extension = 'js';
            $assets = $combineJs;
        }

        /*
         * Apply registered aliases
         */
        if ($aliasMap = $this->getAliases($extension)) {
            foreach ($assets as $key => $asset) {
                if (substr($asset, 0, 1) !== '@') {
                    continue;
                }
                $_asset = substr($asset, 1);

                if (isset($aliasMap[$_asset])) {
                    $assets[$key] = $aliasMap[$_asset];
                }
            }
        }

        return [$assets, $extension];
    }
protected function prepareAssets ( array $ assets ) { if ( ! is_array ( $ assets ) ) { $ assets = [ $ assets ] ; } /*
         * Split assets in to groups.
         */ $ combineJs = [ ] ; $ combineCss = [ ] ; foreach ( $ assets as $ asset ) { /*
             * Allow aliases to go through without an extension
             */ if ( substr ( $ asset , 0 , 1 ) == '@' ) { $ combineJs [ ] = $ asset ; $ combineCss [ ] = $ asset ; continue ; } $ extension = File :: extension ( $ asset ) ; if ( in_array ( $ extension , self :: $ jsExtensions ) ) { $ combineJs [ ] = $ asset ; continue ; } if ( in_array ( $ extension , self :: $ cssExtensions ) ) { $ combineCss [ ] = $ asset ; continue ; } } /*
         * Determine which group of assets to combine.
         */ if ( count ( $ combineCss ) > count ( $ combineJs ) ) { $ extension = 'css' ; $ assets = $ combineCss ; } else { $ extension = 'js' ; $ assets = $ combineJs ; } /*
         * Apply registered aliases
         */ if ( $ aliasMap = $ this -> getAliases ( $ extension ) ) { foreach ( $ assets as $ key => $ asset ) { if ( substr ( $ asset , 0 , 1 ) !== '@' ) { continue ; } $ _asset = substr ( $ asset , 1 ) ; if ( isset ( $ aliasMap [ $ _asset ] ) ) { $ assets [ $ key ] = $ aliasMap [ $ _asset ] ; } } } return [ $ assets , $ extension ] ; }
Prepares an array of assets by normalizing the collection
and processing aliases.
@param array $assets
@return array
Prepares an array of assets by normalizing the collection and processing aliases .