| 1 | <?php |
||
| 5 | class File |
||
| 6 | { |
||
| 7 | |||
| 8 | /** |
||
| 9 | * @param string $filename |
||
| 10 | * @param mixed $contents |
||
| 11 | * |
||
| 12 | * @return bool|int |
||
| 13 | */ |
||
| 14 | 1 | public static function put($filename, $contents) |
|
| 15 | { |
||
| 16 | 1 | return \file_put_contents($filename, $contents); |
|
| 17 | } |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param string $source |
||
| 21 | * @param string $mode |
||
| 22 | * |
||
| 23 | * @return bool|resource |
||
| 24 | */ |
||
| 25 | 3 | public static function open($source, $mode = 'r') |
|
| 26 | { |
||
| 27 | 3 | return @\fopen($source, $mode . 'b'); |
|
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param resource $handle |
||
| 32 | * |
||
| 33 | * @return bool |
||
| 34 | */ |
||
| 35 | 1 | public static function close($handle) |
|
| 36 | { |
||
| 37 | 1 | return \fclose($handle); |
|
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @param string $path |
||
| 42 | * |
||
| 43 | * @return bool |
||
| 44 | */ |
||
| 45 | 1 | public static function touch($path) |
|
| 46 | { |
||
| 47 | 1 | return @\touch($path); |
|
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @param string $path |
||
| 52 | * |
||
| 53 | * @return bool|string |
||
| 54 | */ |
||
| 55 | 2 | public static function real($path) |
|
| 56 | { |
||
| 57 | 2 | return \realpath($path); |
|
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @param string $path |
||
| 62 | * |
||
| 63 | * @return bool |
||
| 64 | */ |
||
| 65 | public static function remove($path) |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @param string $path |
||
| 72 | * |
||
| 73 | * @return int |
||
| 74 | */ |
||
| 75 | public static function size($path) |
||
| 79 | |||
| 80 | /** |
||
| 81 | * @param string $path |
||
| 82 | * |
||
| 83 | * @return bool |
||
| 84 | */ |
||
| 85 | public static function exists($path) |
||
| 89 | |||
| 90 | /** |
||
| 91 | * @param string $path |
||
| 92 | * |
||
| 93 | * @return bool |
||
| 94 | */ |
||
| 95 | public static function isReadable($path) |
||
| 99 | |||
| 100 | /** |
||
| 101 | * @param string $path |
||
| 102 | * |
||
| 103 | * @return bool |
||
| 104 | */ |
||
| 105 | public static function isFile($path) |
||
| 109 | |||
| 110 | /** |
||
| 111 | * @param string $path |
||
| 112 | * |
||
| 113 | * @return bool |
||
| 114 | */ |
||
| 115 | public static function isLink($path) |
||
| 119 | |||
| 120 | /** |
||
| 121 | * @param string $path |
||
| 122 | * @param string $link |
||
| 123 | * |
||
| 124 | * @return bool |
||
| 125 | */ |
||
| 126 | public static function symlink($path, $link) |
||
| 130 | |||
| 131 | } |
||
| 132 |