Method | Description | |
---|---|---|
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. |
public static ensureExtension ( string $file, string $extension ) : the | ||
$file | string | The file where extension should be append if not existing |
$extension | string | |
return | the | ensured file/path with extension |
public static getFileHash ( string $sourceFile ) : false | string | ||
$sourceFile | string | The path to the file |
return | false | string | Returns false or the md5 hash of this file |
public static getFileInfo ( string $sourceFile ) : object | ||
$sourceFile | string | The path of the file |
return | object | With extension and name keys. |
public static humanReadableFilesize ( integer $size ) : string | ||
$size | integer | The size to convert in Byte |
return | string | The readable size definition |