1 | <?php |
||
19 | class FileHelper |
||
20 | { |
||
21 | /** |
||
22 | * Reads and returns file content. |
||
23 | * @param string $path |
||
24 | * @return string|false false if can't read |
||
25 | */ |
||
26 | public static function read($path, $die = true) |
||
39 | |||
40 | /** |
||
41 | * Writes given content to the file. |
||
42 | * Doesn't touch file if it has exactly same content. |
||
43 | * Creates intermediate directories when necessary. |
||
44 | * @param string $path |
||
45 | * @param string $content |
||
46 | * @return bool true if file was changed |
||
47 | */ |
||
48 | 3 | public static function write($path, $content) |
|
71 | |||
72 | /** |
||
73 | * Creates directory if not exists. |
||
74 | * Creates intermediate directories when necessary. |
||
75 | * @param string $path |
||
76 | * @return bool true if directory did not exist and was created |
||
77 | */ |
||
78 | 3 | public static function mkdir($path) |
|
91 | |||
92 | /** |
||
93 | * Creates a symlink. |
||
94 | * @param string $src existing source path |
||
95 | * @param string $dst destionation path to be created |
||
96 | * @return true on success and false/null on failure |
||
97 | */ |
||
98 | public static function symlink($src, $dst) |
||
109 | } |
||
110 |