Returns file contents as array of tuples (['line' => 12, 'text' => '...'])
@param string $filename
@return array
350814
public function getContentInTuples ($filename)
	{
		$result     = [];
		$lineNumber = 1;

		// load file and create array of tuples (line, code)
		foreach (file ($filename) as $line)
		{
			$result[] = [
				'line' => $lineNumber++,
				'text' => rtrim($line)
			];
		}

		return $result;
	}
619582
static function read_file_to_string($filename)
    {
        $output = false;
        try {
            $output = file_get_contents($filename);
        } catch (Exception $e) {
            echo ('Error reading file: '.var_export($e, true).PHP_EOL);
            die();
        }
        return $output;
    }
1150293
protected function getContentType($filename)
    {
        $extension = pathinfo($filename, PATHINFO_EXTENSION);
        $contentType = Psr7\mimetype_from_extension($extension);

        return ['contentType' => $contentType];
    }
1345484
public function getFile($filename) {

        $filename = realpath(__DIR__.'/../headers/'.$filename.'.txt');

        if(!file_exists($filename)) throw new \Exception('Filename doesnt exist.');

        return file_get_contents($filename);
    }
1035829
public function fetch($filename): string {
        return $this->_getApi()->getObject([
            'Bucket' => $this->_config['bucket'],
            'Key' => $this->_getUri($filename),
        ])->get('Body');
    }
887205
public function read($fileName=null)
    {
        $this->_resetFileName($fileName);

        $manifest = array();
        $hashLen = ($this->hashEncoding == 'sha1') ? 40 : 32;
        $lines = readLines($this->fileName, $this->fileEncoding);

        foreach ($lines as $line) {
            $hash = trim(substr($line, 0, $hashLen));
            $payload = trim(substr($line, $hashLen));

            if (strlen($payload) > 0) {
                $manifest[$payload] = $hash;
            }
        }

        $this->data = $manifest;
        return $manifest;
    }
287688
protected function getFileContent($filename)
    {
        if (!file_exists($filename)) {
            throw new \InvalidArgumentException(sprintf(self::ERR_NO_SUCH_BLOG, $filename));
        }
        return file_get_contents($filename);
    }
349336
public static function getCumulativeFilename($filename) {
        $filename = self::formatFilename($filename);

        $filenameParts = explode('.', $filename);
        $ext = array_pop($filenameParts);
        $base = implode('.', $filenameParts);
        $base = preg_match('/' . self::SEPERATOR . '\d+$/', $base) ?
            preg_replace_callback(
                '/' . self::SEPERATOR . '(\d+)$/',
                function ($matches) {
                    return Garp_File::SEPERATOR . ++$matches[1];
                },
                $base
            ) :
            $base . self::SEPERATOR . '2'
        ;

        return $base . '.' . $ext;
    }
797168
private function getFileContentSafety($filename) {
        $file = fopen($filename, 'r');
        flock($file, LOCK_SH);
        $content = file_get_contents($filename);
        flock($file, LOCK_UN);
        fclose($file);

        return $content;
    }
403575
public function fetch($filename): string {
        $data = file_get_contents($this->_getFilePath($filename));
        if ($this->_gzip) {
            $probablyGzipped = bin2hex(substr($data, 0, 2)) == '1f8b';
            $data = $probablyGzipped ? gzdecode($data) : $data;
        }
        return $data;
    }
908631
public function load(string $filename): array {
		$extension = pathinfo($filename, PATHINFO_EXTENSION);
		
		if(method_exists($this, $extension)) {
			$parameters = $this->{$extension}($filename);
		} else {
			$parameters = [];
		}
		
		if(!isset($parameters["driver"])) {
			$parameters += ["driver" => "pdo_mysql"];
		}
		
		if(!isset($parameters["charset"])) {
			$parameters += ["charset" => "utf8", "driverOptions" => [1002 => "SET NAMES UTF8"]];
		}
		
		return $parameters;
	}
744950
public static function load( $fileName )
	{
		if( !file_exists( $fileName ) )
			throw new Exception( 'File "'.$fileName.'" is not existing.' );

		$reader	= new FS_File_Reader( $fileName );
		$lines	= $reader->readArray();
		
		$list	= array();
		foreach( $lines as $line )
		{
			$line = trim( $line );
			if( !$line )
				continue;
			if( preg_match( self::$commentPattern, $line ) )
				continue;
					
			if( preg_match( self::$sectionPattern, $line ) )
			{
				$section = substr( $line, 1, -1 );
				if( !isset( $list[$section] ) )
					$list[$section]	= array();
			}
			else if( $section )
				$list[$section][]	= $line;
		}
		return $list;
	}
1086088
public function getFileContent($fileName)
    {
        $entry = $this->rar->getEntry($fileName);
        if ($entry->isDirectory()) return false;
        return stream_get_contents($entry->getStream());
    }
773240
public function read($filename)
    {
        if (!is_readable($filename)) {
            throw new FileNotFoundException(sprintf('File "%s" does not exist.', $filename), 0, null, $filename);
        }

        return file_get_contents($filename);
    }
75152
private static function getIgnoredFiles($file) {
    if (file_exists($file) === FALSE) {
      return array();
    }

    $contents = file_get_contents($file);
    if ($contents === FALSE) {
      return array();
    }

    return preg_split('/\s+/', $contents);
  }
213002
protected function getFileParts($filename)
    {
        if (preg_match('/(.*)@(\d+)x\.(.*)$/', $filename, $matches)) {
            $name = $matches[1];
            $extension = $matches[3];
            $extra = (int) $matches[2];
            $type = 'alternative';

            if ($extra === 1) {
                $type = 'base';
                $extra = null;
            }
        } else {
            $fileParts = explode('.', $filename);

            $name = array_shift($fileParts);
            $extension = null;
            $extra = null;
            $type = 'base';

            while (($part = array_shift($fileParts)) !== null) {
                if ($part !== 'meta' && $part !== 'thumb') {
                    if (null !== $extension) {
                        $name .= '.' . $extension;
                    }
                    $extension = $part;
                } else {
                    $type = $part;
                    $extra = '.' . $part . '.' . implode('.', $fileParts);
                    break;
                }
            }
        }

        return array($name, $extension, $type, $extra);
    }
913123
public function read($fileName)
    {
        $parsedYaml = $this->readFromCache($fileName);
        if ($parsedYaml !== null) {
            return $parsedYaml;
        }

        try {
            $fileContent = file_get_contents($fileName);
            $parsedYaml  = Yaml::parse($fileContent);
            if (!is_array($parsedYaml)) {
                $parsedYaml = [];
            }
            $this->writeToCache($fileName, $parsedYaml);
            return $parsedYaml;
        } catch (\Exception $e) {
            throw new \RuntimeException('Could not read Yaml file '.$fileName, $e->getCode(), $e);
        }
    }