| Total Complexity | 4 |
| Total Lines | 49 |
| 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 | * |
||
| 19 | * @return string path of temporary file |
||
| 20 | */ |
||
| 21 | 1 | public static function tmpFilePut($buffer) |
|
| 22 | { |
||
| 23 | 1 | list(, $path) = self::tmpFile(); |
|
| 24 | 1 | file_put_contents($path, $buffer); |
|
| 25 | |||
| 26 | 1 | return $path; |
|
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Create handle and path of a temporary file (which gets cleaned up) |
||
| 31 | * |
||
| 32 | * @return array [resource stream-handle, string path] |
||
| 33 | */ |
||
| 34 | 2 | public static function tmpFile() |
|
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Create temporary directory (which does not get cleaned up) |
||
| 49 | * |
||
| 50 | * @param string $prefix [optional] |
||
| 51 | * |
||
| 52 | * @return string path |
||
| 53 | */ |
||
| 54 | 1 | public static function tmpDir($prefix = '') |
|
| 61 | } |
||
| 62 | } |
||
| 63 |