@param string|null $file

@return string

@throws \chillerlan\QRCode\Output\QRCodeOutputException
779212
protected function dumpImage(string $file = null):string{
		$file = $file ?? $this->options->cachefile;

		\ob_start();

		try{
			\call_user_func([$this, $this->outputMode ?? $this->defaultMode]);
		}
		// not going to cover edge cases
		// @codeCoverageIgnoreStart
		catch(\Exception $e){
			throw new QRCodeOutputException($e->getMessage());
		}
		// @codeCoverageIgnoreEnd

		$imageData = \ob_get_contents();
		\imagedestroy($this->image);

		\ob_end_clean();

		if($file !== null){
			$this->saveToFile($imageData, $file);
		}

		return $imageData;
	}
65596
public static function rpath(String $file = NULL) : String
    {
        $config = Config::get('Filesystem', 'file', self::$access);

        self::$access = NULL;

        if( $config['parentDirectoryAccess'] === false )
        {
            $file = str_replace('../', '', $file);
        }

        if( $config['realPath'] === true )
        {
            $file = Base::prefix(self::originpath($file), REAL_BASE_DIR);
        }

        return $file;
    }
759109
private function getFirstClassNameInFile(File $file): ?string
    {
        $position = $file->findNext(T_CLASS, 0);

        if ($position === false) {
            return null;
        }

        $fileClassName = ClassHelper::getFullyQualifiedName($file, $position);

        return ltrim($fileClassName, '\\');
    }
691457
public static function urlencodeFilename($file) {
    $parts = explode('/', $file);
    $result = [];
    foreach ($parts as $part) {
      $result[] = rawurlencode($part);
    }
    return join('/', $result);
  }
158960
public function json($file = null) : Json
    {
        if ($file === null) {
            $file = 'module.json';
        }

        return array_get($this->moduleJson, $file, function () use ($file) {
            return $this->moduleJson[$file] = new Json($this->getPath() . '/' . $file, $this->app['files']);
        });
    }
115316
public function export($file = null)
    {
        if ($file) {
            return isset($this->_coverage[$file]) ? $this->_coverage($file, $this->_coverage[$file]) : [];
        }
        $result = [];
        $base = preg_quote($this->base(), '~');
        foreach ($this->_coverage as $file => $rawCoverage) {
            if ($coverage = $this->_coverage($file, $rawCoverage)) {
                $result[preg_replace("~^{$base}~", '', $file)] = $coverage;
            }
        }
        return $result;
    }
1102944
public static function editorUri(
        string $file,
        int $line = null,
        string $action = 'open',
        string $search = '',
        string $replace = ''
    ): ?string {
        if (Debugger::$editor && $file && ($action === 'create' || is_file($file))) {
            $file = \str_replace('/', DIRECTORY_SEPARATOR, $file);
            $file = \strtr($file, Debugger::$editorMapping);

            return strtr(Debugger::$editor, [
                '%action' => $action,
                '%file' => rawurlencode($file),
                '%line' => $line ?: 1,
                '%search' => rawurlencode($search),
                '%replace' => rawurlencode($replace),
            ]);
        }

        return null;
    }
461977
protected function resolve_file_path($file = null)
    {
        if (is_null($file)) {
            $file = $this->args->file;
        }

        if (file_exists($file)) {
            return $file;
        }

        $dirname  = dirname($file);
        $filename = basename($file);
        $relpath  = $dirname ? "/$dirname" : '';
        $path     = getcwd() . "$relpath/$filename";

        /**
         * realpath will return false if path does not exist
         */
        return realpath($path) ?: str_replace('/./', '/', $path);
    }
650938
private function loadFile(string $file) : string
    {
        if (!file_exists($file)) {
            throw new \Exception($file . ' not found');
        }
        return (string)file_get_contents($file);
    }
1258392
public static function database_path(?string $file = null)
  {
    $file = (substr($file, 0, 1) == DIRECTORY_SEPARATOR ? substr($file, 1) : $file);
    return config('app.dir') . 'database' . DIRECTORY_SEPARATOR . $file;
  }
1010430
protected function getFilePath(string $file, ?string $extension = null, ?string $suffix = null): string
	{
		if(strpos($file, '::') === false)
		{
			// No namespace so we'll just use the default path

			$path = $this->path;
		}
		else
		{
			// The file is namespaced so we'll use the namespace path

			[$namespace, $file] = explode('::', $file, 2);

			if(!isset($this->namespaces[$namespace]))
			{
				throw new RuntimeException(vsprintf('The [ %s ] namespace does not exist.', [$namespace]));
			}

			$path = $this->namespaces[$namespace];
		}

		// Append suffix to path if needed

		if($suffix !== null)
		{
			$path .= DIRECTORY_SEPARATOR . $suffix;
		}

		// Return full path to file

		return $path . DIRECTORY_SEPARATOR . str_replace('.', DIRECTORY_SEPARATOR, $file) . ($extension ?? $this->extension);
	}
977456
public function getFileEditLink($file)
    {
        if (!$file || !$file->isInDB()) {
            return null;
        }

        return Controller::join_links(
            $this->Link('show'),
            $file->ParentID,
            'edit',
            $file->ID
        );
    }
357428
public function shortPath($file)
    {
        $shortPath = str_replace(ROOT, null, $file);
        $shortPath = str_replace('..' . DIRECTORY_SEPARATOR, '', $shortPath);
        $shortPath = str_replace(DIRECTORY_SEPARATOR, '/', $shortPath);

        return str_replace('//', DIRECTORY_SEPARATOR, $shortPath);
    }
5114
public function read(string $file): string
    {
        $destFile = tempnam(sys_get_temp_dir(), 'pdf_to_text_');

        $command = sprintf(
            'pdftotext -layout %s %s',
            escapeshellarg(realpath($file)),
            escapeshellarg($destFile)
        );

        $return = 0;
        $output = system($command, $return);

        $content = file_get_contents($destFile);
        unlink($destFile);

        switch ($return) {
            case 0:
                return $content;

            default:
                throw new \Exception($command . PHP_EOL . $output, $return);
        }
    }
331817
public static function imagesInternal($file = null)
    {
        return base_path(
            self::appendToPath(
                self::appendToPath(config('pxlcms.paths.base_internal'), config('pxlcms.paths.images')),
                $file
            )
        );
    }
227515
public static function getMimeTypeByFile(string $file)
    {
        if (!\is_file($file) || !\class_exists('\finfo', false)) {
            return null;
        }

        try {
            $finfo = new \finfo(FILEINFO_MIME_TYPE);

            return $finfo->file($file) ?: null;
            // @codeCoverageIgnoreStart
        } catch (\ErrorException $e) {
            // This is caused by an array to string conversion error.
            return null;
        }
    }
1341111
public function generateExtension($file = null)
    {
        if ($file === null) {
            $file = $this->val();
        } elseif (is_string($file)) {
            if (in_array($file, $this->acceptedMimetypes())) {
                $mime = $file;
            } else {
                $mime = $this->mimetypeFor($file);
            }
        }

        return '';
    }