PHP 클래스 Ouzo\Utilities\Files

파일 보기 프로젝트 열기: letsdrink/ouzo 1 사용 예제들

공개 메소드들

메소드 설명
convertUnitFileSize ( integer $size ) : string Converts file size in bytes to a string with unit.
copyContent ( string $inputFile, string $outputFile, integer $bufferSize = 1024 ) Copies content from $inputFile to $outputFile.
delete ( string $path ) : boolean Deletes file, throws FileNotFoundException if the file does not exist.
deleteIfExists ( $path ) : boolean Deletes file if exists, otherwise return false if the file does not exist.
exists ( string $path ) : boolean Checks if the given file exists.
getFilesRecursivelyWithSpecifiedExtension ( string $dir, string $extension ) : array Returns all files from the given directory that have the given extension.
load ( string $path, boolean $loadOnce = true ) Loads a file using require or require_once if the $loadOnce flag is set to true, if the file does not exist, throws FileNotFoundException.
loadIfExists ( string $path, boolean $loadOnce = true ) : boolean Loads a file using require or require_once if the $loadOnce flag is set to true.
mimeType ( string $path ) : string Returns mime type for the given file path.
move ( string $sourcePath, string $destinationPath ) : boolean Moves file from the source to the destination, throws FileNotFoundException if the source directory does not exist.
size ( string $path ) : integer Returns a size of the given file.

비공개 메소드들

메소드 설명
_require ( $path, $loadOnce )

메소드 상세

convertUnitFileSize() 공개 정적인 메소드

Example: $unit = Files::convertUnitFileSize(146432); Result: 143 KB
public static convertUnitFileSize ( integer $size ) : string
$size integer
리턴 string

copyContent() 공개 정적인 메소드

Copies content from $inputFile to $outputFile.
public static copyContent ( string $inputFile, string $outputFile, integer $bufferSize = 1024 )
$inputFile string
$outputFile string
$bufferSize integer

delete() 공개 정적인 메소드

Deletes file, throws FileNotFoundException if the file does not exist.
public static delete ( string $path ) : boolean
$path string
리턴 boolean

deleteIfExists() 공개 정적인 메소드

Deletes file if exists, otherwise return false if the file does not exist.
public static deleteIfExists ( $path ) : boolean
$path
리턴 boolean

exists() 공개 정적인 메소드

Checks if the given file exists.
public static exists ( string $path ) : boolean
$path string
리턴 boolean

getFilesRecursivelyWithSpecifiedExtension() 공개 정적인 메소드

Returns all files from the given directory that have the given extension.
public static getFilesRecursivelyWithSpecifiedExtension ( string $dir, string $extension ) : array
$dir string
$extension string
리턴 array

load() 공개 정적인 메소드

Loads a file using require or require_once if the $loadOnce flag is set to true, if the file does not exist, throws FileNotFoundException.
public static load ( string $path, boolean $loadOnce = true )
$path string
$loadOnce boolean

loadIfExists() 공개 정적인 메소드

Loads a file using require or require_once if the $loadOnce flag is set to true.
public static loadIfExists ( string $path, boolean $loadOnce = true ) : boolean
$path string
$loadOnce boolean
리턴 boolean

mimeType() 공개 정적인 메소드

Returns mime type for the given file path.
public static mimeType ( string $path ) : string
$path string
리턴 string

move() 공개 정적인 메소드

Moves file from the source to the destination, throws FileNotFoundException if the source directory does not exist.
public static move ( string $sourcePath, string $destinationPath ) : boolean
$sourcePath string
$destinationPath string
리턴 boolean

size() 공개 정적인 메소드

Returns a size of the given file.
public static size ( string $path ) : integer
$path string
리턴 integer