PHP 클래스 luya\helpers\FileHelper

저자: Basil Suter ([email protected])
상속: extends yii\helpers\BaseFileHelper
파일 보기 프로젝트 열기: zephir/luya 1 사용 예제들

공개 메소드들

메소드 설명
ensureExtension ( string $file, string $extension ) : the Append a file extension to a path/file if there is no or an empty extension provided, this helper methods is used to make sure the right extension existing on files.
getFileContent ( string $fileName ) : string | boolean Basic helper to retreive the content of a file and catched exception. The filename will auto alias encode by Yii::getAlias function.
getFileHash ( string $sourceFile ) : false | string Generate a md5 hash of a file. This is eqauls to md5sum command
getFileInfo ( string $sourceFile ) : object Get extension and name from a file for the provided source/path of the file.
humanReadableFilesize ( integer $size ) : string Generate a human readable size informations from provided Byte/s size
writeFile ( string $fileName, string $content ) : boolean Basic helper method to write files with exception capture. The fileName will auto wrapped trough the Yii::getAlias function.

메소드 상세

ensureExtension() 공개 정적인 메소드

Append a file extension to a path/file if there is no or an empty extension provided, this helper methods is used to make sure the right extension existing on files.
public static ensureExtension ( string $file, string $extension ) : the
$file string The file where extension should be append if not existing
$extension string
리턴 the ensured file/path with extension

getFileContent() 공개 정적인 메소드

Basic helper to retreive the content of a file and catched exception. The filename will auto alias encode by Yii::getAlias function.
부터: 1.0.0-beta7
public static getFileContent ( string $fileName ) : string | boolean
$fileName string The path to the file to get the content
리턴 string | boolean

getFileHash() 공개 정적인 메소드

Generate a md5 hash of a file. This is eqauls to md5sum command
public static getFileHash ( string $sourceFile ) : false | string
$sourceFile string The path to the file
리턴 false | string Returns false or the md5 hash of this file

getFileInfo() 공개 정적인 메소드

Get extension and name from a file for the provided source/path of the file.
public static getFileInfo ( string $sourceFile ) : object
$sourceFile string The path of the file
리턴 object With extension and name keys.

humanReadableFilesize() 공개 정적인 메소드

Generate a human readable size informations from provided Byte/s size
public static humanReadableFilesize ( integer $size ) : string
$size integer The size to convert in Byte
리턴 string The readable size definition

writeFile() 공개 정적인 메소드

Basic helper method to write files with exception capture. The fileName will auto wrapped trough the Yii::getAlias function.
public static writeFile ( string $fileName, string $content ) : boolean
$fileName string The path to the file with file name
$content string The content to store in this File
리턴 boolean