| Total Complexity | 4 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class LibTmp |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * Create temporary file w/ contents |
||
| 16 | * |
||
| 17 | * @param string $buffer |
||
| 18 | * @return string path of temporary file |
||
| 19 | */ |
||
| 20 | 1 | public static function tmpFilePut($buffer) |
|
| 21 | { |
||
| 22 | 1 | list(, $path) = self::tmpFile(); |
|
| 23 | 1 | file_put_contents($path, $buffer); |
|
| 24 | |||
| 25 | 1 | return $path; |
|
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Create handle and path of a temporary file (which gets cleaned up) |
||
| 30 | * |
||
| 31 | * @return array(handle, string) |
||
| 32 | */ |
||
| 33 | 2 | public static function tmpFile() |
|
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Create temporary directory (which does not get cleaned up) |
||
| 48 | * |
||
| 49 | * @param string $prefix [optional] |
||
| 50 | * @return string path |
||
| 51 | */ |
||
| 52 | 1 | public static function tmpDir($prefix = '') |
|
| 59 | } |
||
| 60 | } |
||
| 61 |