[readDelimFileDetDelim description]

@param resource $fh file handle

@return string
761226
protected static function readDelimFileDetDelim($fh)
	{
		$line = '';
		if ($fh) {
			while (!feof($fh)) {
				$line = trim(fgets($fh, 4096));
				if (!empty($line)) {
					break;
				}
			}
			fseek($fh, 0);		// go back to beginning of file
		}

		$delims = array(',', "\t");
		$delim_counts = array();
		foreach ($delims as $delim) {
			$delim_counts[$delim] = substr_count($line, $delim);
		}
		arsort($delim_counts);
		$keys = array_keys($delim_counts);
		$delim = reset($keys);
		return $delim;
	}
411458
protected static function readFile($file)
    {
        $length = filesize($file);

        if (!($fd = fopen($file, 'rb'))) {
            throw new Exception("Cannot read the file '$file', probably permissions");
        }

        $content = $length ? fread($fd, $length) : '';
        fclose($fd);

        return $content;
    }
959431
public function read($delim = '#')
    {
        $file = file_get_contents($this->file);

        $delim = preg_quote($delim);
        if (preg_match("/#\s$delim\s(.*?)\s#\s\\\\$delim/s", $file, $matches)) {
            return trim($matches[1]);
        } else {
            return false;
        }
    }
1335453
public function parseMultiFile($file)
    {
        if (!file_exists($file)) {
            return false;
        }
        $ret = array();
        $fh = fopen($file, 'r');
        if (!$fh) {
            return false;
        }
        while (!feof($fh)) {
            $ret[] = $this->parseHandle($fh);
        }
        fclose($fh);
        return $ret;
    }
226997
public function readFile($fileName)
	{
		if (!isset($this->format))
			$this->format = \PhpOffice\PhpSpreadsheet\IOFactory::identify($fileName);
		$objectreader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($this->format);
		if ($this->format == "Csv") {
			$objectreader->setDelimiter($this->CSVDelimiter);
			$objectreader->setInputEncoding($this->CSVEncoding);
		}
		$objectPhpExcel = $objectreader->load($fileName);

		$sheetCount = $objectPhpExcel->getSheetCount();

		$sheetDatas = [];

		if ($sheetCount > 1) {
			foreach ($objectPhpExcel->getSheetNames() as $sheetIndex => $sheetName) {
				if (isset($this->getOnlySheet) && $this->getOnlySheet != null) {
					if(!$objectPhpExcel->getSheetByName($this->getOnlySheet)) {
						return $sheetDatas;
					}
					$objectPhpExcel->setActiveSheetIndexByName($this->getOnlySheet);
					$indexed = $this->getOnlySheet;
					$sheetDatas[$indexed] = $objectPhpExcel->getActiveSheet()->toArray(null, true, true, true);
					if ($this->setFirstRecordAsKeys) {
						$sheetDatas[$indexed] = $this->executeArrayLabel($sheetDatas[$indexed]);
					}
					if (!empty($this->getOnlyRecordByIndex)) {
						$sheetDatas[$indexed] = $this->executeGetOnlyRecords($sheetDatas[$indexed], $this->getOnlyRecordByIndex);
					}
					if (!empty($this->leaveRecordByIndex)) {
						$sheetDatas[$indexed] = $this->executeLeaveRecords($sheetDatas[$indexed], $this->leaveRecordByIndex);
					}
					return $sheetDatas[$indexed];
				} else {
					$objectPhpExcel->setActiveSheetIndexByName($sheetName);
					$indexed = $this->setIndexSheetByName==true ? $sheetName : $sheetIndex;
					$sheetDatas[$indexed] = $objectPhpExcel->getActiveSheet()->toArray(null, true, true, true);
					if ($this->setFirstRecordAsKeys) {
						$sheetDatas[$indexed] = $this->executeArrayLabel($sheetDatas[$indexed]);
					}
					if (!empty($this->getOnlyRecordByIndex) && isset($this->getOnlyRecordByIndex[$indexed]) && is_array($this->getOnlyRecordByIndex[$indexed])) {
						$sheetDatas = $this->executeGetOnlyRecords($sheetDatas, $this->getOnlyRecordByIndex[$indexed]);
					}
					if (!empty($this->leaveRecordByIndex) && isset($this->leaveRecordByIndex[$indexed]) && is_array($this->leaveRecordByIndex[$indexed])) {
						$sheetDatas[$indexed] = $this->executeLeaveRecords($sheetDatas[$indexed], $this->leaveRecordByIndex[$indexed]);
					}
				}
			}
		} else {
			$sheetDatas = $objectPhpExcel->getActiveSheet()->toArray(null, true, true, true);
			if ($this->setFirstRecordAsKeys) {
				$sheetDatas = $this->executeArrayLabel($sheetDatas);
			}
			if (!empty($this->getOnlyRecordByIndex)) {
				$sheetDatas = $this->executeGetOnlyRecords($sheetDatas, $this->getOnlyRecordByIndex);
			}
			if (!empty($this->leaveRecordByIndex)) {
				$sheetDatas = $this->executeLeaveRecords($sheetDatas, $this->leaveRecordByIndex);
			}
		}

		return $sheetDatas;
	}
44893
public function read($file)
    {
        $file = '/data/' . $file;

        /**
         * @todo validate that $file is a string
         */

        $result = [];

        $ext = pathinfo($file, PATHINFO_EXTENSION);

        if (isset($this->converters[$ext])) {

            $meta = [];

            $content = '';

            $file_contents = $this->source_filesystem->read($file);

            if ($file_contents) {

                $parts = preg_split('/\-{3}/', $file_contents, 3);

                if (count($parts) === 3) {

                    $meta = $parts[1] ?: [];

                    $content = $parts[2];
                } else {

                    $content = $file_contents;
                }

                $result = $this->yaml->parse($meta);

                $content = $this->converters[$ext]->convert($content);

                $result['content'] = trim($content);
            }
        }

        return $result;
    }
855962
private function loadFile($file)
    {

        $f = array();
        if (file_exists($file))
            try {
                $f = parse_ini_file($file, true);
            } catch (\Exception $ex) {
                throw new \OWeb\manage\exceptions\Settings("Failed to load Settings file : '$file'", 0, $ex);
            }

        return $f;

    }
345247
public function read($count = 0)
    {
        if (0 === $count) {
            $count = -1;
        }
        fseek($this->resource, $this->readPosition);
        $content = stream_get_contents($this->resource, $count);
        $this->readPosition = ftell($this->resource);
        return $content;
    }
292693
public function read($max = null)
    {
        $max = min($max ?: PHP_INT_MAX, $this->remaining);
        if ($this->remaining <= 0 || feof($this->data)) {
            $this->close();
            return '';
        }
        $this->remaining -= $max;

        return fread($this->data, $max);
    }
1045246
private function _getFileMeta($file, $parentLevel = 0)
    {
        $meta = array('file' => $file);

        if ($meta['exist'] = (bool)file_exists($file)) {
            $meta['writeable'] = (bool)is_writable($file);

            $uid = fileowner($file);
            if (function_exists('posix_getpwuid')) {
                $uinfo = posix_getpwuid($uid);
                $uid   = $uinfo['name'];
            }

            $gid = filegroup($file);
            if (function_exists('posix_getgrgid')) {
                $ginfo = posix_getgrgid($gid);
                $gid   = $ginfo['name'];
            }

            $meta['owner']                  = $uid;
            $meta['group']                  = $gid;
            $meta['permission']             = substr(sprintf('%o', fileperms($file)), -4);
            $meta['last_modification_time'] = date('d.m.Y H:i:s', filemtime($file));

            if (is_file($file)) {
                $meta['filesize'] = round(filesize($file) / (1024 * 1024), 4) . ' MB';
            }
        } elseif ($parentLevel > 0) {
            $fInfo = pathinfo($file);
            if (file_exists($fInfo['dirname'])) {
                $meta['parent_dir'] = $this->_getFileMeta($fInfo['dirname'], --$parentLevel);
            }
        }

        return $meta;
    }
903942
function readFile($file)
	{
		$fh = @fopen($file, 'r');

		$lines = false;
		if ($fh !== false) {
			$lines = array();
			while (!feof($fh)) {
				$lines[] = fgets($fh);
			}
			fclose($fh);
		}
		return $lines;
	}
1242234
public function getFileIcon($file = '')
    {
        $extension = File::extension($file);

        foreach ($this->fileTypes as $type => $regex) {
            if (preg_match("/^($regex)$/i", $extension) !== 0) {
                return "fa-file-{$type}-o";
            }
        }

        return 'fa-file-o';
    }
816630
private function getFileHeaders(PostFileInterface $file)
    {
        $headers = '';
        foreach ($file->getHeaders() as $key => $value) {
            $headers .= "{$key}: {$value}\r\n";
        }

        return "--{$this->boundary}\r\n" . trim($headers) . "\r\n\r\n";
    }
1275273
public static function getMime($file)
    {
        $fileInfo = finfo_open(FILEINFO_MIME_TYPE);
        $mime = finfo_file($fileInfo, $file);

        return empty($mime) ? : $mime;
    }
787290
public static function readfile($full, $fsencoding = '') {
        $full = self::conv_to($full, $fsencoding);
        $mime_type = self::get_mime($full);
        if ($mime_type !== null) {
            header('Content-Type: ' . $mime_type);
            readfile($full);
        }
    }
74888
public function stream_read($count)
    {
        if (self::WRITEONLY === $this->mode) {
            return '';
        }

        if ($this->content->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) {
            return '';
        }

        return $this->content->read($count);
    }
1101858
public function fileLog (string $delimeter="|", ...$keys)
    {
        $this->delimeter 	= $delimeter;
        $this->keys 		= $keys;
    	// Validates Delimeter
        if ($this->validateAttribute("delimeter") == FALSE) return $this;
    	// Validates Keys
        if ($this->validateAttribute("keys") == FALSE) return $this;

        // Sets the log file.
    	$this->processLogFile();

		$logMessage = '';
    	for ($i = 0; $i < count($keys); $i++)
    	{
    		$key 		 = $keys[$i];
    		$logMessage .= ((count($keys) - 1) != $i) ? "{$key} $delimeter " : "{$key}";
    	}
        $logMessage .= PHP_EOL;

        // FILE_APPEND adds content to the end of the file
        // LOCK_EX forbids writing to the file while in use by us
        file_put_contents($this->logFile, $logMessage, FILE_APPEND | LOCK_EX);
		return $this;
    }