| 1 | <?php |
||
| 13 | class File |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @var resource |
||
| 17 | */ |
||
| 18 | protected $file; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var string |
||
| 22 | */ |
||
| 23 | protected $path; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param string $path |
||
| 27 | * @param string $mode |
||
| 28 | */ |
||
| 29 | 48 | public function __construct($path, $mode = 'wb') |
|
| 34 | |||
| 35 | /** |
||
| 36 | * Closes an open file pointer. |
||
| 37 | * |
||
| 38 | * @return boolean |
||
| 39 | */ |
||
| 40 | 45 | public function close() |
|
| 44 | |||
| 45 | /** |
||
| 46 | * Reads entire file into a string. |
||
| 47 | * |
||
| 48 | * @return string |
||
| 49 | */ |
||
| 50 | 3 | public function getContents() |
|
| 51 | { |
||
| 52 | 3 | return file_get_contents($this->path); |
|
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Writes a string to a file. |
||
| 57 | * |
||
| 58 | * @param string $content |
||
| 59 | * @return integer|boolean |
||
| 60 | */ |
||
| 61 | 45 | public function putContents($content) |
|
| 65 | |||
| 66 | /** |
||
| 67 | * Changes the file mode of the file. |
||
| 68 | * |
||
| 69 | * @param integer $mode |
||
| 70 | * @return boolean |
||
| 71 | */ |
||
| 72 | 30 | public function chmod($mode) |
|
| 76 | } |
||
| 77 |