public function processCombinedFiles()
    {
        // Check if combining is enabled
        if (!$this->getCombinedFilesEnabled()) {
            return;
        }

        // Before scripts are modified, detect files that are provided by preceding ones
        $providedScripts = $this->getProvidedScripts();

        // Process each combined files
        foreach ($this->getAllCombinedFiles() as $combinedFile => $combinedItem) {
            $fileList = $combinedItem['files'];
            $type = $combinedItem['type'];
            $options = $combinedItem['options'];

            // Generate this file, unless blocked
            $combinedURL = null;
            if (!isset($this->blocked[$combinedFile])) {
                // Filter files for blocked / provided
                $filteredFileList = array_diff(
                    $fileList,
                    $this->getBlocked(),
                    $providedScripts
                );
                $combinedURL = $this->getCombinedFileURL($combinedFile, $filteredFileList, $type);
            }

            // Replace all existing files, injecting the combined file at the position of the first item
            // in order to preserve inclusion order.
            // Note that we iterate across blocked files in order to get the correct order, and validate
            // that the file is included in the correct location (regardless of which files are blocked).
            $included = false;
            switch ($type) {
                case 'css': {
                    $newCSS = array(); // Assoc array of css file => spec
                    foreach ($this->getAllCSS() as $css => $spec) {
                        if (!in_array($css, $fileList)) {
                            $newCSS[$css] = $spec;
                        } elseif (!$included && $combinedURL) {
                            $newCSS[$combinedURL] = array('media' => (isset($options['media']) ? $options['media'] : null));
                            $included = true;
                        }
                        // If already included, or otherwise blocked, then don't add into CSS
                    }
                    $this->css = $newCSS;
                    break;
                }
                case 'js': {
                    // Assoc array of file => attributes
                    $newJS = array();
                    foreach ($this->getAllJavascript() as $script => $attributes) {
                        if (!in_array($script, $fileList)) {
                            $newJS[$script] = $attributes;
                        } elseif (!$included && $combinedURL) {
                            $newJS[$combinedURL] = $options;
                            $included = true;
                        }
                        // If already included, or otherwise blocked, then don't add into scripts
                    }
                    $this->javascript = $newJS;
                    break;
                }
            }
        }
    }