Busca un archivo por su nombre en la carpeta del exportador
@param type $fileName
@return \Symfony\Component\Finder\SplFileInfo
@throws RuntimeException
180883
public function getFile($fileName) {
        $files = $this->getFiles();
        $found = null;
        foreach ($files as $file) {
            if($file->getRelativePathname() === $fileName){
                if(!$file->isReadable()){
                    throw new RuntimeException(sprintf("The file '%s' could not be read.",$fileName));
                }
                $found = $file;
                break;
            }
        }
        return $found;
    }
383375
private function readFile($fileName) {
        try {
            $data = file_get_contents($fileName, false);
        }
        catch (PHPError $ex) {
            if (strEndsWith($ex->getMessage(), 'failed to open stream: No such file or directory'))
                return null;
            throw $ex;
        }

        if ($data === false)
            throw new RuntimeException('file_get_contents() returned FALSE, $fileName: "'.$fileName);

        return unserialize($data);
    }
146448
public function getFileData($fileName)
    {
        return new ArchiveEntry($this->inArchiveFileName, filesize($this->fileName),
            $this->uncompressedSize, $this->modificationTime);
    }
932325
public static function load(string $filename): ConfigInterface
    {
        if (!file_exists($filename)) {
            throw new \RuntimeException(sprintf('Expected config in %s, but the file does not exist.', $filename), 1);
        }
        // Try to determine the realpath of the file, if possible.
        $filename = realpath($filename) ?: $filename;
        try {
            $config = require $filename;
        } catch (Exception $e) {
            throw new \RuntimeException(sprintf('There was an error loading config from %s. Message: %s', $filename, $e->getMessage()), 1, $e);
        }
        if (1 === $config) {
            throw new \RuntimeException(sprintf('No configuration was returned from %s.', $filename), 1);
        }
        if (!$config instanceof ConfigInterface) {
            throw new \RuntimeException(sprintf('Configuration returned from %s is not an instance of %s.', $filename, ConfigInterface::class), 1);
        }
        if ('' === $config->getDocroot()) {
            $config->setDocroot(dirname($filename));
        }
        if ('' === $config->getCachePrefix()) {
            $config->setCachePrefix(md5($filename));
        }

        return $config;
    }
630633
public function exportToFile(string $filename, string $password = NULL) {
        $status = openssl_pkey_export_to_file(
            $this->getHandle(),
            $filename,
            $password
        );
        if(!$status) {
            throw new RuntimeException(OpenSSL::getLastError());
        }
    }
1259034
public function findFirstOccurenceOfFile(string $fileName)
    {
        if (!$this->isDir() || !$this->exists()) {
            return null;
        }

        foreach ($this->scanDir() as $file) {
            if ($file->getFileName() === $fileName) {
                return $file;
            }

            if ($file->isDir()) {
                $result = $file->findFirstOccurenceOfFile($fileName);
                if ($result !== null) {
                    return $result;
                }
            }
        }
        return null;
    }
1352013
private function loadFile($filename)
    {
        $dom = new Document();
        $dom->formatOutput = true;
        $dom->load($filename);

        $this->applyReferenceElementtype($dom);

        return $dom;
    }
723143
public function getFiles()
    {
        if (isset($this->raw->files)) {
            $base = $this->getBasePath();
            $files = array();

            foreach ((array) $this->raw->files as $file) {
                $file = new SplFileInfo(
                    $path = $base . DIRECTORY_SEPARATOR . Path::canonical($file)
                );

                if (false === $file->isFile()) {
                    throw new RuntimeException(
                        sprintf(
                            'The file "%s" does not exist or is not a file.',
                            $path
                        )
                    );
                }

                $files[] = $file;
            }

            return $files;
        }

        return array();
    }
86950
protected function readConfig($filename)
    {
        if (empty($filename) || !is_string($filename) || !file_exists($filename)) {
            throw new RuntimeException(sprintf('Configuration file "%s" was not found.', $filename));
        }
        $this->_modifiedTime = max($this->_modifiedTime, filemtime($filename));

        if (function_exists('parse_ini_file')) {
            return parse_ini_file($filename, true);
        } else {
            return parse_ini_string(file_get_contents($filename), true);
        }
    }
775194
public static function getContents($filename)
    {
        $file = fopen($filename, "r");

        if ($file === false) {
            throw new \RuntimeException("Cannot read the file: {$filename}");
        }

        $data = [];
        while ($row = fgetcsv($file)) {
            $data[] = $row;
        }

        fclose($file);

        return $data;
    }
758136
public function fromFile($filename, $object = true)
    {
        if (!is_file($filename) || !is_readable($filename)) {
            throw new \RuntimeException(sprintf("File '%s' doesn't exist or not readable", $filename));
        }

        $string = file_get_contents($filename);
        return $this->fromString($string, $object);
    }
988703
public function toFile($filename, ObjectConfigInterface $config)
    {
        $pathinfo = pathinfo($filename);

        if (!isset($pathinfo['extension']))
        {
            throw new \RuntimeException(sprintf(
                'Filename "%s" is missing an extension and cannot be auto-detected', $filename
            ));
        }

        $this->createFormat($pathinfo['extension'])->toFile($filename, $config);
        return $this;
    }
623671
public function save($filename)
    {
        $type = pathinfo($filename, PATHINFO_EXTENSION);
        $type = ($type === 'jpg') ? 'jpeg' : $type;
        $type = (in_array($type, $this->imageTypes)) ? $type : 'png';

        header('Content-type: image/' . $type);

        $imageFunc = 'image' . $type;
        $imageFunc($this->image, $filename);

        $this->destroy($this->image);

        return $this;
    }
489945
public function save($filename)
    {
        $json = [];
        foreach ($this as $cookie) {
            /** @var SetCookie $cookie */
            if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) {
                $json[] = $cookie->toArray();
            }
        }

        $jsonStr = \GuzzleHttp\json_encode($json);
        if (false === file_put_contents($filename, $jsonStr)) {
            throw new \RuntimeException("Unable to save file {$filename}");
        }
    }
1116431
public function find($fileName)
    {
        $fileName = $this->validateFileName($fileName);

        $filePath = $this->getFilePath($fileName);

        if (!File::isFile($filePath)) {
            return null;
        }

        if (($content = @File::get($filePath)) === false) {
            return null;
        }

        $this->fileName = $fileName;
        $this->mtime = File::lastModified($filePath);
        $this->content = $content;
        return $this;
    }
853445
public function deleteFile($fileName) {
        $files = $this->getFiles();
        $success = false;
        foreach ($files as $file) {
            if($file->getRelativePathname() === $fileName){
                if(!$file->isWritable()){
                    throw new RuntimeException(sprintf("The file '%s' is not writable and can not be deleted.",$fileName));
                }
                unlink($file->getRealPath());
                if($file->isReadable()){
                    throw new RuntimeException(sprintf("The file '%s' could not be deleted",$fileName));
                }
                $success = true;
            }
        }
        return $success;
    }
635895
public static function lintFile($filename)
    {
        if (!file_exists($filename)) {
            return false;
        }

        if (self::supported(self::SUPPORT_RUNKIT_SANDBOX)) {
            /** @noinspection PhpUndefinedFunctionInspection */
            return runkit_lint_file($filename);
        }

        $cmd = 'php -l ' . escapeshellcmd($filename) . ' 2>&1';

        exec($cmd, $output, $retcode);

        return 0 === $retcode;
    }