Add assets stored in files to render in the head

@param array $cssFiles An array of filenames
@param array $jsFiles  An array of filenames
@param string $basePath Base path of those files
@param string $baseUrl  Base url of those files
@return $this
762100
public function addAssets($cssFiles, $jsFiles, $basePath = null, $baseUrl = null)
    {
        $this->additionalAssets[] = array(
            'base_path' => $basePath,
            'base_url' => $baseUrl,
            'css' => (array) $cssFiles,
            'js' => (array) $jsFiles
        );
        return $this;
    }
136674
public function addFiles($filePaths): self
    {
        if (is_string($filePaths)) {
            $filePaths = [$filePaths];
        }

        foreach ($filePaths as $filePath) {
            if (! empty($filePath)) {
                file_put_contents($this->manifestPath, $filePath.PHP_EOL, FILE_APPEND);
            }
        }

        return $this;
    }
695515
public function load($basePath)
    {
        $this->assertThatFactoriesDirectoryExists($basePath);

        $designer = new Designer;
        $faker = new FakerAdapter;

        $factory = function ($name, $shortName, $attributes = []) use ($designer, $faker) {
            return $designer->define($name, $shortName, $attributes);
        };

        foreach ((new FactoriesFinder($basePath))->find() as $file) {
            include($file);
        }

        return $designer->definitions();
    }
1224954
public function appendFile($sourceFilePath)
    {
        // open the new uploaded chunk
        if (!$in = @fopen($sourceFilePath, 'rb')) {
            @fclose($this->destinationFile);
            throw new ChunkSaveException('Failed to open input stream', 101);
        }

        // read and write in buffs
        while ($buff = fread($in, 4096)) {
            fwrite($this->destinationFile, $buff);
        }

        @fclose($in);

        return $this;
    }
456391
public function getUrl($paths, $basePath = null)
    {
        if (is_array($paths) === false) {
            $paths = array($paths);
        }

        $minUrl = $this->container->get('router')->generate('rednose_combo_handler_combo');

        foreach ($paths as &$path) {
            if ($basePath !== null) {
                $path = $basePath . '/' . $path;
            }

            $files[] = $path;
        }

        $files = implode(',', $paths);

        return $minUrl . '?' . $files;
    }
413559
function fetchFilePathsByType(distFiles, basePath, type) {
  return distFiles
    .filter(function(filePath) {
      return new RegExp('assets/.*\\.' + type + '$').test(filePath);
    })
    .map(function(filePath) {
      return path.join(basePath, filePath);
    });
}
252357
protected function registerAssets($files)
    {
        foreach ($files as $type => $_files) {
            if ($type == 'script') {
                foreach ($_files as $file) {
                    $this->view->registerJsFile($this->assetUrl . $file);
                }
            } else {
                foreach ($_files as $file) {
                    $this->view->registerCssFile($this->assetUrl . $file);
                }
            }
        }
    }
1158421
private function addBaseurl2ImageSource(&$filtered, $baseurl)
    {
        $textf  = $this->di->get("textfilter");
        $url    = $this->di->get("url");

        // Use callback to url->create() instead of string concat
        $callback = function ($route) use ($url, $baseurl) {
            return $url->asset($route, $baseurl);
        };

        $filtered->text =
            $textf->addBaseurlToImageSource($filtered->text, $baseurl, $callback);
    }
781710
private function setJavascriptFileCDNforHighChartsMain($jsFileName, $libName)
    {
        $jsFN            = $this->sanitizeString($jsFileName);
        $jsVersionlessFN = str_replace([$libName . '-', '.js'], '', pathinfo($jsFileName)['basename'])
            . ($libName === 'exporting' ? '/modules' : '');
        if (strpos($jsFileName, $libName) !== false) {
            return [
                true,
                $this->sCloundFlareUrl . 'highcharts/' . $jsVersionlessFN . '/' . $libName . '.js',
                '<script>!window.Highcharts && document.write(\'<script src="' . $jsFN . '">\x3C/script>\')</script>',
            ];
        }
        return null;
    }
565890
private static function validateSource($basePath, $sourcePath)
    {
        $urlData = parse_url($sourcePath);
        if (!empty($urlData['scheme'])) {
            return;
        }

        if (!\helpers_File::isFileInsideDirectory($sourcePath, $basePath)) {
            throw new InvalidSourcePathException($basePath, $sourcePath);
        }
    }
901074
private function loadFactories($factoriesPath)
    {
        $factoriesPath = $factoriesPath ?: static::$factoriesPath;

        if ( ! static::$factories) {
            static::$factories = (new FactoriesLoader)->load($factoriesPath);
        }
    }
111982
public function getJavascriptRenderer($baseUrl = null, $basePath = null)
    {
        if ($this->jsRenderer === null) {
            $this->jsRenderer = new JsRender($this, $baseUrl, $basePath);
            $this->jsRenderer->setUrlGenerator($this->di['url']);
        }
        return $this->jsRenderer;
    }
1373489
public function addFiles($fileOrFiles)
    {
        $files_list = self::createFilesList($fileOrFiles);
        if (empty($files_list))
            throw new InvalidArgumentException('Files list is empty!');
        $result = $this->archive->addFiles($files_list);
        $this->scanArchive();
        return $result;
    }
448973
public function addJs($pFile, $pFooter = false)
	{
		if (! $pFooter) {
			$this->_js[self::JS_MARKER_HEADER][] = $pFile;
		} else {
			$this->_js[self::JS_MARKER_FOOTER][] = $pFile;
		}

		return $this;
	}
259453
public function addSubdirectory($sitePath)
    {
        $paths = array_map(function ($subDir) use ($sitePath) {
            return "$sitePath/$subDir";
        }, $this->possibleSubdirectories());

        $foundPaths = array_filter($paths, function ($path) {
            return file_exists($path);
        });

        // If paths are found, return the first one.
        if (!empty($foundPaths)) {
            return array_shift($foundPaths);
        }

        // If there are no matches, return the original path.
        return $sitePath;
    }
322397
private function copyUninlineableCssToStyleNode(\DOMXPath $xPath, array $cssRules)
    {
        $cssRulesRelevantForDocument = \array_filter(
            $cssRules,
            function (array $cssRule) use ($xPath) {
                $selector = $cssRule['selector'];
                if ($cssRule['hasUnmatchablePseudo']) {
                    $selector = $this->removeUnmatchablePseudoComponents($selector);
                }
                return $this->existsMatchForCssSelector($xPath, $selector);
            }
        );

        if ($cssRulesRelevantForDocument === []) {
            // avoid adding empty style element (or including unneeded class dependency)
            return;
        }

        $cssConcatenator = new CssConcatenator();
        foreach ($cssRulesRelevantForDocument as $cssRule) {
            $cssConcatenator->append([$cssRule['selector']], $cssRule['declarationsBlock'], $cssRule['media']);
        }

        $this->addStyleElementToDocument($cssConcatenator->getCss());
    }
928970
public function basePath($basePath)
    {
        if (strlen($basePath) > 1 && substr($basePath, -1) === '/') {
            $this->basePath = substr($basePath, 0, -1);
        } else {
            $this->basePath = $basePath;
        }

        return $this;
    }