| 1 | <?php |
||
| 18 | class Utils |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * GZIPs a file on disk (appending .gz to the name). |
||
| 22 | * |
||
| 23 | * Based on function by Simon East at: http://stackoverflow.com/questions/6073397/how-do-you-create-a-gz-file-using-php |
||
| 24 | * |
||
| 25 | * @param string $source Path to file that should be compressed |
||
| 26 | * @param string $newFile new filename |
||
| 27 | * @param int $level GZIP compression level (default: 9) |
||
| 28 | * |
||
| 29 | * @return string New filename (with .gz appended) if success, or false if operation fails |
||
| 30 | */ |
||
| 31 | 1 | public static function gzCompressFile($source, $newFile, $level = 9) |
|
| 55 | |||
| 56 | /** |
||
| 57 | * Utility function to remove empty values and null from json strings. |
||
| 58 | * |
||
| 59 | * @param string $json in json |
||
| 60 | * |
||
| 61 | * @return mixed cleaned |
||
| 62 | */ |
||
| 63 | 10 | public static function removeEmptyAndNullJson($json) |
|
| 67 | } |
||
| 68 |