Returns general information about a file.

Returns an array on success and false otherwise.

@param string $filename
@return mixed
@access public
322182
function stat($filename)
    {
        if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) {
            return false;
        }

        $filename = $this->_realpath($filename);
        if ($filename === false) {
            return false;
        }

        if ($this->use_stat_cache) {
            $result = $this->_query_stat_cache($filename);
            if (is_array($result) && isset($result['.']) && isset($result['.']->stat)) {
                return $result['.']->stat;
            }
            if (is_object($result) && isset($result->stat)) {
                return $result->stat;
            }
        }

        $stat = $this->_stat($filename, NET_SFTP_STAT);
        if ($stat === false) {
            $this->_remove_from_stat_cache($filename);
            return false;
        }
        if (isset($stat['type'])) {
            if ($stat['type'] == NET_SFTP_TYPE_DIRECTORY) {
                $filename.= '/.';
            }
            $this->_update_stat_cache($filename, (object) array('stat' => $stat));
            return $stat;
        }

        $pwd = $this->pwd;
        $stat['type'] = $this->chdir($filename) ?
            NET_SFTP_TYPE_DIRECTORY :
            NET_SFTP_TYPE_REGULAR;
        $this->pwd = $pwd;

        if ($stat['type'] == NET_SFTP_TYPE_DIRECTORY) {
            $filename.= '/.';
        }
        $this->_update_stat_cache($filename, (object) array('stat' => $stat));

        return $stat;
    }
573264
protected function getContent($filename)
	{
		$file=@fopen($filename,"r");
		if($file && flock($file,LOCK_SH))
		{
			$contents=@file_get_contents($filename);
			flock($file,LOCK_UN);
			fclose($file);
			return $contents;
		}
		return false;
	}
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;
	}
716175
public function getMimeType($filename)
	{
	    $mimetype = false;
	    
	    if(function_exists('finfo_fopen')) 
	    {
	       $mimetype = finfo_fopen($filename);
	    } 
	    elseif(function_exists('getimagesize')) 
	    {
	       $mimetype = getimagesize($filename);
	    } 
	    elseif(function_exists('exif_imagetype')) 
	    {
	       $mimetype = exif_imagetype($filename);
	    } 
	    elseif(function_exists('mime_content_type')) 
	    {
	       $mimetype = mime_content_type($filename);
	    }
	    
	    return $mimetype['mime'];
	}
288142
function lstat($filename)
    {
        if (!($this->bitmap & SSH2::MASK_LOGIN)) {
            return false;
        }

        $filename = $this->_realpath($filename);
        if ($filename === false) {
            return false;
        }

        if ($this->use_stat_cache) {
            $result = $this->_query_stat_cache($filename);
            if (is_array($result) && isset($result['.']) && isset($result['.']->lstat)) {
                return $result['.']->lstat;
            }
            if (is_object($result) && isset($result->lstat)) {
                return $result->lstat;
            }
        }

        $lstat = $this->_stat($filename, NET_SFTP_LSTAT);
        if ($lstat === false) {
            $this->_remove_from_stat_cache($filename);
            return false;
        }
        if (isset($lstat['type'])) {
            if ($lstat['type'] == NET_SFTP_TYPE_DIRECTORY) {
                $filename.= '/.';
            }
            $this->_update_stat_cache($filename, (object) array('lstat' => $lstat));
            return $lstat;
        }

        $stat = $this->_stat($filename, NET_SFTP_STAT);

        if ($lstat != $stat) {
            $lstat = array_merge($lstat, array('type' => NET_SFTP_TYPE_SYMLINK));
            $this->_update_stat_cache($filename, (object) array('lstat' => $lstat));
            return $stat;
        }

        $pwd = $this->pwd;
        $lstat['type'] = $this->chdir($filename) ?
            NET_SFTP_TYPE_DIRECTORY :
            NET_SFTP_TYPE_REGULAR;
        $this->pwd = $pwd;

        if ($lstat['type'] == NET_SFTP_TYPE_DIRECTORY) {
            $filename.= '/.';
        }
        $this->_update_stat_cache($filename, (object) array('lstat' => $lstat));

        return $lstat;
    }
707865
protected function getFile($filename)
    {
        try {
            $api = $this->client->api('repositories');
            /* @var Repositories $api */
            $file = $api->getFile($this->raw['path_with_namespace'], $filename, 'master');
            if ('base64' === $file['encoding']) {
                return base64_decode($file['content'], true);
            }
        } catch (\Exception $e) {
            //file not found
        }
    }
12162
public function read(string $filename): array
    {
        $lines = ['total' => 0, 'read' => 0];

        // Open file as SPL object
        $file = new \SplFileObject($filename);

        // Read line by line
        while (!$file->eof()) {
            $line = $file->fgets();
            // Save line only of not empty
            if ($this->isLine($line) && \strlen($line) > 1) {
                $line = trim(preg_replace('/\s+/', ' ', $line));
                $this->_lines[] = $line;
                $lines['read']++;
            }
            $lines['total']++;
        }
        return $lines;
    }
906463
public function getFileData($fileName)
    {
        if (!in_array($fileName, $this->files, true))
            return false;

        return $this->archive->getFileData($fileName);
    }
641238
public function getMime($filename)
    {
        switch (substr($filename, -3)) {
            case "css":
                $mime = "text/css";
                break;
            case ".js":
                $mime = "text/javascript";
                break;
            default:
                $mime = (new \finfo(FILEINFO_MIME_TYPE))->file($filename);

        }

        return $mime;
    }
583718
protected function getUniqueFilename($fileName)
    {
        $returnValue = uniqid(hash('crc32', $fileName));
    
        $ext = @pathinfo($fileName, PATHINFO_EXTENSION);
        if (!empty($ext)){
            $returnValue .= '.' . $ext;
        }
    
        return $returnValue;
    }
1326773
public function getObjectInfo($fileName)
	{
		$s3 = $this->getInstance();

		return $s3->getObjectInfo($this->_bucketName, $fileName);
	}
88959
public function getFileContent($fileName)
    {
        $Location = array_search($fileName, $this->files, true);
        if (!isset($this->filesData[$fileName])) return false;
        $data = $this->filesData[$fileName];
        $Location_Real = $Location * $this->blockSize;
        if ($this->iso->Seek($Location_Real, SEEK_SET) === false)
            return false;

        return $this->iso->Read($data['size']);
    }
1362664
public function loadJson($filename)
  {
    $result = false;
    if (file_exists($filename) && is_file($filename)) {
      $json = file_get_contents($filename);
      $data = json_decode($json, true);
      if (is_array($data)) {
        foreach ($data as $name => $value) {
          $this->__set($name, $value);
        }
        $result = true;
      }
    }
    return $result;
  }
71671
protected function checkFileName($fileName)
    {
        $extension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));

        $allow = $this->getWhitelistedExtensions();
        $block = $this->getBlacklistedExtensions();

        return  (   (false === $allow || in_array($extension, $allow))
                &&  (false === $block || ! in_array($extension, $block))
                );
    }
30296
static function read($filename) {
        if (file_exists($filename) && self::isReadable($filename)) {
            return file_get_contents($filename);
        }

        return NULL;
    }
1309987
public function getNamesWithDifferentExtension(string $fileName)
    {
        if (! file_exists($this->basePath)) {
            return [];
        }

        $extension = pathinfo($fileName, PATHINFO_EXTENSION);

        $baseName = substr($fileName, 0, strlen($fileName) - strlen($extension) - 1);

        $allNames = scandir($this->basePath);

        $namesWithDifferentExtension = array_filter($allNames, function ($existingName) use ($baseName, $extension) {
            $existingExtension = pathinfo($existingName, PATHINFO_EXTENSION);

            $existingBaseName = substr($existingName, 0, strlen($existingName) - strlen($existingExtension) - 1);

            return $existingBaseName === $baseName && $existingExtension !== $extension;
        });

        return array_values($namesWithDifferentExtension);
    }
1261413
protected function getData( $filename )
    {

        $matches = [];

        $regex = '/(.+)-([0-9_]+)x([0-9_]+)(-resize)*(\-\[([\-\d\.]+)x([\-\d\.]+)\])*\.([A-z]+)$/';

        preg_match( $regex, $filename, $matches );


        $path = $matches[1];
        $extension = $matches[8];
        $imagePath = sprintf( '%s/%s.%s', dirname( $filename ), basename( $path ), $extension );

        $width = $matches[2];
        $height = $matches[3];

        $focusX = $matches[6];
        $focusY = $matches[7];

        return [
            'filepath'=> $imagePath,
            'resize'=> $matches[4] != '',

            'width'=> $width != '_' ? $width : null,
            'height'=> $height != '_' ? $height : null,

            'focusX' => $focusX != '' ? $focusX : null,
            'focusY' => $focusY != '' ? $focusY : null,
        ];

    }