Add a PDF for inclusion in the merge with a valid file path. Pages should be formatted: 1,3,6, 12-16.
@param $filepath
@param $pages
@return void
486064
public function addPDF($filepath, $pages = 'all', $orientation = null)
    {
        if (file_exists($filepath)) {
            if (strtolower($pages) != 'all') {
                $pages = $this->_rewritepages($pages);
            }

            $this->_files[] = array($filepath, $pages, $orientation);
        } else {
            throw new Exception("Could not locate PDF on '$filepath'");
        }

        return $this;
    }
693056
public function addMerged($file_path, $media = 'screen')
    {
        $_fp = $this->__template->findAsset($file_path);
        if ($_fp || \AssetsManager\Loader::isUrl($file_path)) {
            $this->registry->addEntry(array(
                'file'=>$_fp, 'media'=>$media
            ), 'css_merged_files');
        } else {
            throw new \InvalidArgumentException(
                sprintf('CSS merged file "%s" not found!', $file_path)
            );
        }
        return $this;
    }
109766
public function createPdfCommand($targetPath)
    {
        $command    = $this->createCommand($this->url, 'pdf', ['path' => $targetPath]);
        if ($this->showBrowserHeaderAndFooter) {
            $command['options']['displayHeaderFooter'] = true;
        }
        if ($this->showBackground) {
            $command['options']['printBackground'] = true;
        }
        if ($this->landscape) {
            $command['options']['landscape'] = true;
        }
        if ($this->margins) {
            $command['options']['margin'] = [
                'top' => $this->margins['top'].'mm',
                'right' => $this->margins['right'].'mm',
                'bottom' => $this->margins['bottom'].'mm',
                'left' => $this->margins['left'].'mm',
            ];
        }
        if ($this->pages) {
            $command['options']['pageRanges'] = $this->pages;
        }
        if ($this->paperWidth > 0 && $this->paperHeight > 0) {
            $command['options']['width'] = $this->paperWidth.'mm';
            $command['options']['height'] = $this->paperHeight.'mm';
        }
        if ($this->format) {
            $command['options']['format'] = $this->format;
        }
        return $command;
    }
765287
protected function publishFile($filePath)
    {
        $publicFilePath = str_replace(PATH_RESOURCES, PATH_PUBLIC, $filePath);
        $publicFileDir = dirname($publicFilePath) . DIRECTORY_SEPARATOR;

        $extension = pathinfo($filePath, PATHINFO_EXTENSION);

        $publicMinifyFilePath = str_replace('.' . $extension, '.min.' . $extension, $publicFilePath);

        $fileContent = file_get_contents($filePath);
        $fileVersion = $this->getVersion($fileContent);
        
        if (is_file($mapFilePath = $publicFilePath . '.map')) {
            $mapMetadata = json_decode(file_get_contents($mapFilePath), true);
            // if the file version is changed delete it first
            if ( ! hash_equals($fileVersion, $mapMetadata[ 'version' ])) {
                unlink($publicFilePath);
                unlink($publicMinifyFilePath);
                unlink($mapFilePath);
            }
        }

        if ( ! is_file($mapFilePath)) {
            if ( ! empty($fileContent)) {
                $mapMetadata = [
                    'version'        => $fileVersion,
                    'sources'        => [
                        $filePath,
                    ],
                    'names'          => [],
                    'mappings'       => [],
                    'file'           => pathinfo($publicMinifyFilePath, PATHINFO_BASENAME),
                    'sourcesContent' => [
                        $fileContent,
                    ],
                    'sourceRoot'     => '',
                ];
                
                if ( ! is_dir($publicFileDir)) {
                    @mkdir($publicFileDir, 0777, true);
                }

                if (is_writable($publicFileDir)) {
                    if ($fileStream = @fopen($publicFilePath, 'ab')) {
                        flock($fileStream, LOCK_EX);
                        fwrite($fileStream, $fileContent);
                        flock($fileStream, LOCK_UN);
                        fclose($fileStream);

                        // File Map
                        if ($fileStream = @fopen($mapFilePath, 'ab')) {
                            flock($fileStream, LOCK_EX);

                            fwrite($fileStream, json_encode($mapMetadata));

                            flock($fileStream, LOCK_UN);
                            fclose($fileStream);
                        }

                        switch ($extension) {
                            case 'min.css':
                            case 'css':
                                $minifyStyleHandler = new CSS($publicFilePath);
                                $minifyStyleHandler->minify($publicMinifyFilePath);
                                break;

                            case 'min.js':
                            case 'js':
                                $minifyJavascriptHandler = new JS($publicFilePath);
                                $minifyJavascriptHandler->minify($publicMinifyFilePath);
                                break;
                        }

                    }
                }
            }
        }

        return [
            'filePath' => $publicFilePath,
            'url'      => $this->getUrl($publicFilePath),
            'minify'   => [
                'filePath' => $publicMinifyFilePath,
                'url'      => $this->getUrl($publicMinifyFilePath),
            ],
            'version'  => $fileVersion,
        ];
    }
419601
public function writeFile($filePath, array $translations)
    {
        $content = "<?php \n\nreturn [";

        $content .= $this->stringLineMaker($translations);

        $content .= "\n];";

        file_put_contents($filePath, $content);
    }
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;
    }
352402
protected function validateFilePath($filePath)
    {
        if (false === (\is_dir($filePath) && \is_writable($filePath))) {
            throw new SitemapException(
                \sprintf("Provided path '%s' does not exist or is not writable.", $filePath)
            );
        }
    }
908852
public static function addClass($className, $filePath)
	{
        if (self::classExists($className)) {
			throw new ApplicationContextException('Cannot add class file [' . $filePath . '], class with same name already defined by [' . self::$classNames[$className] . ']');
        }

        self::$classNames[$className] = $filePath;
	}
28051
public function filePutContents($filePath, $data)
    {
        $bytesWritten = @file_put_contents($filePath, $data);
        if ($bytesWritten === false) {
            throw new FileSystemException('File '.$filePath.' could not be written');
        }
        return true;
    }
172754
public function setFilePath($filePath)
    {
        $this->isURI = false;
        $this->filePath = trim($filePath);

        $this->content = null;
        return $this;
    }
201643
protected function buildDirectory($filePath)
	{
		$directory = dirname($filePath);
		
		if (!is_dir($directory)) {
			mkdir($directory, 0777, true);
		}
	}
1042060
public function move($file, $filePath)
	{
 		$this->buildDirectory($filePath);
 		$this->moveFile($file, $filePath);
        $this->setPermissions($filePath, $this->attachedFile->override_file_permissions);
	}
1161173
public static function bindings(string $filePath = null)
    {
        if (is_file($filePath)) {
            /** @noinspection PhpIncludeInspection */
            $bindings = require_once $filePath;

            $bindings = is_array($bindings) ? $bindings : [];

            IOC::addBindings($bindings);

            Event::dispatch('minimal.loaded.bindings', [$filePath, $bindings]);
        }
    }
603095
protected function interfacePostCopy(
        string $filePath
    ): void {
        $this->findAndReplaceHelper->replaceFieldInterfaceNamespace($this->interfaceNamespace, $filePath);
        $this->replaceDefaultValueInInterface($filePath);
        $this->postCopy($filePath);
    }
643136
public function handle($filePath, $results)
    {
        $responseCollection = new PredefinedResponseCollection();
        $responseCollection->append(
            new PredefinedResponse('postpone', 'postpone', self::POSTPONE)
        );
        $responseCollection->append(
            new PredefinedResponse('show diff', 'show diff', self::SHOW_DIFF)
        );
        $responseCollection->append(
            new PredefinedResponse('erase', 'erase', self::ERASE)
        );
        $responseCollection->append(
            new PredefinedResponse('cancel', 'cancel', self::CANCEL)
        );

        $question = new QuestionWithPredefinedResponse(
            sprintf('File "%s" already exist, erase it with the new', $filePath),
            'conflict' . $filePath,
            $responseCollection
        );

        $question->setShutdownWithoutResponse(true, sprintf('Conflict with file "%s" not resolved', $filePath));

        while (($response = $this->context->askCollection($question)) !== null) {
            $response = intval($response);

            if ($response === self::SHOW_DIFF) {
                // write to output the diff
                $this->context->log(
                    '<info>' . $this->diffPHP->diff($results, $this->fileManager->fileGetContent($filePath)) . '</info>'
                );
            } else {
                break;
            }
        }

        if ($response === self::POSTPONE) {
            //Generate the diff file
            $this->fileManager->filePutsContent(
                $filePath . '.diff',
                $this->diffPHP->diff(
                    $results,
                    $this->fileManager->fileGetContent($filePath)
                )
            );
            $this->context->log('--> Generate diff and new file ' . $filePath . '.diff', 'generationLog');
        } elseif ($response === self::ERASE) {
            $this->fileManager->filePutsContent($filePath, $results);
            $this->context->log('--> Replace file ' . $filePath, 'generationLog');
        }
    }
22456
public static function add($file_path, array $file_manipulations)
    {
        self::$file_manipulations[$file_path] = isset(self::$file_manipulations[$file_path])
            ? array_merge(self::$file_manipulations[$file_path], $file_manipulations)
            : $file_manipulations;
    }
975422
public static void mergePdf(File[] inputPdfFiles, File outputPdfFile) {
        if (PDFBOX.equals(System.getProperty(PDF_LIBRARY))) {
            PdfBoxUtilities.mergePdf(inputPdfFiles, outputPdfFile);
        } else {
            try {
                PdfGsUtilities.mergePdf(inputPdfFiles, outputPdfFile);
            } catch (Exception e) {
                System.setProperty(PDF_LIBRARY, PDFBOX);
                mergePdf(inputPdfFiles, outputPdfFile);
            }
        }
    }