1 | <?php |
||
7 | class File { |
||
8 | |||
9 | use FileOperationTrait; |
||
10 | |||
11 | public function __construct($filename) { |
||
14 | |||
15 | /** |
||
16 | * Reads contents from the file |
||
17 | * |
||
18 | * @throws FileException |
||
19 | * @return string contents |
||
20 | */ |
||
21 | public function read() { |
||
32 | |||
33 | /** |
||
34 | * Writes contents to the file |
||
35 | * |
||
36 | * @param string $contents |
||
37 | * @return $this |
||
38 | */ |
||
39 | public function write($contents) { |
||
46 | |||
47 | /** |
||
48 | * Touches the file |
||
49 | * |
||
50 | * @param int|DateTime $created |
||
51 | * @param int|DateTime $lastAccessed |
||
52 | * @throws FileException when something goes wrong |
||
53 | */ |
||
54 | public function touch($created = null, $lastAccessed = null) { |
||
66 | |||
67 | /** |
||
68 | * Deletes the file |
||
69 | * |
||
70 | * @throws FileException when something goes wrong |
||
71 | */ |
||
72 | public function delete() { |
||
77 | |||
78 | /** |
||
79 | * String representation of this file as pathname |
||
80 | */ |
||
81 | public function __toString() { |
||
84 | |||
85 | } |
||
86 |