@param $file

@return int|string
490195
public function getFileLineCount($file)
    {
        $count = 0;

        try {
            if (false === strpos($file, $this->container->getParameter('kernel.project_dir'))) {
                $file = $this->container->getParameter('kernel.project_dir').$file;
            }

            $handle = fopen($file, 'r');
        } catch (\Exception $exception) {
            return $exception->getMessage();
        }

        while (!feof($handle)) {
            $line = fgets($handle);
            ++$count;
        }

        fclose($handle);

        return $count;
    }
1294708
public static function getMimeType($file)
    {
        $finfo = finfo_open(FILEINFO_MIME_TYPE);
        $type = finfo_file($finfo, $file);
        finfo_close($finfo);

        return $type;
    }
383031
protected function load_file($file)
	{
		$contents = $this->parse_vars(file_get_contents($file));
		return parse_ini_string($contents, true);
	}
41740
public function loadFile($file)
    {
        $openfile = @fopen($file, "rb") or die("loadFile: Error opening file '{$file}'.");
        $contents = @fread($openfile, filesize($file)) or die("loadFile: Error reading data from file '{$file}'.");
        @fclose($openfile);
        return $contents;
    }
381922
private function compile($file)
    {
        $this->dispatchEvent('before.compile', $file);

        $compiled = $this->getCompiler()->compile(file_get_contents($file));

        $this->dispatchEvent('after.compile', $file);

        return $compiled;
    }
785102
public function createFileName($file)
    {
        if ( ! is_null($this->elfinderFilePath) ) {
            return $this->getFileName();
        }
        if ( is_string($file) ) {
            return substr( strrchr( $file, '/' ), 1 );
        }

        $filename = $file->getClientOriginalName();
        $mime = $file->getClientOriginalExtension();
        $parts = explode('.',$filename);
        array_pop($parts);
        return str_slug( implode(' ', $parts), '-' ) . '_' . time() .  '.' . $mime;
    }
13974
static public function type($file) {
        $type = getimagesize($file);
        $type = $type[2];
        switch($type) {
            case IMAGETYPE_GIF:     return 'gif';
            case IMAGETYPE_JPEG:    return 'jpg';
            case IMAGETYPE_PNG:     return 'png';
        }
        return FALSE;
    }
1017421
public static function getFile( $file ) {
		$file = Storage::getFile( Route::DOCUMENT_ROOT() . 'app/config/' . $file . '.json' );
		$out  = Parser::json( $file );

		return $out;
	}
567288
public function locateFile($file)
    {
        $components = $this->parseResource($file);
        if ($components['path']) {
            $path = dirname($components['path']) . '/public/';

            return $path . $components['file'];
        } else {
            return $components['file'];
        }
    }
936318
public function getFileFunctions($file) {
    $code = file_get_contents($file);
    //drush_print($code);

    $matches = array();
    $pattern = "/^function (\w+)/m";
    preg_match_all($pattern, $code, $matches);

    return $matches[1];
  }
776877
public function file($file)
    {
        $filePaths = loader()->getPublicDirs(true);

        foreach ($filePaths as $filePath) {
            if (is_file($filePath . $file)) {
                return path_to_url($filePath . $file);
                break;
            }
        }
    }
1275273
public static function getMime($file)
    {
        $fileInfo = finfo_open(FILEINFO_MIME_TYPE);
        $mime = finfo_file($fileInfo, $file);

        return empty($mime) ? : $mime;
    }
698108
private function getMimeType($file)
    {
        $type = FileInfo::DIRECTORY_MIME_TYPE;
        if (is_file($file)) {
            if (class_exists('finfo')) {
                $finfo = new \finfo(FILEINFO_MIME);
                $type = $finfo->file($file);
            } else {
                $type = MimeType::getTypeByExt(pathinfo($file, PATHINFO_EXTENSION));
            }
        }
        $type = strstr($type, ';', true) ?: $type;

        return isset(MimeType::$internalType[$type]) ? MimeType::$internalType[$type] : $type;
    }
754511
private function FileGetContents($file) {
    $fileObj = new SplFileObject($file, 'r');
    while (!$fileObj->flock(LOCK_EX)) {
      usleep(1);
    }
    $str = $fileObj->fread($fileObj->getSize());
    $fileObj->flock(LOCK_UN);
    return $str;
  }
1273228
protected function readFile(string $file) : string
    {
        if (is_file($file) === false) {
            throw new BadFileException("The file \"{$file}\" is not a file.", $file);
        }

        if (is_readable($file) === false) {
            throw new BadFileException("Unable to open \"{$file}\" as the file is not readable.", $file);
        }

        return file_get_contents($file);
    }
791686
protected static function _getExtension($file) {
		$pieces = explode('.', $file);
		$ext = strtolower(array_pop($pieces));
		return $ext;
	}
266056
private function getFileContents($file)
    {
        if (!isset($this->filesContent[$file])) {
            $this->filesContent[$file] = file_exists($file) ? file($file) : [];
        }

        return $this->filesContent[$file];
    }