1 | <?php |
||
12 | class BuiltInFilesystem implements Filesystem |
||
13 | { |
||
14 | /** |
||
15 | * @var bool |
||
16 | */ |
||
17 | private $writeLock; |
||
18 | |||
19 | /** |
||
20 | * Initialize BuiltInFilesystem. |
||
21 | * |
||
22 | * @param bool $writeLock whether to use a write lock (LOCK_EX). |
||
23 | */ |
||
24 | public function __construct($writeLock = true) |
||
28 | |||
29 | /** |
||
30 | * Read a file into an array. |
||
31 | * |
||
32 | * @param string $file Path to the file. |
||
33 | * |
||
34 | * @throws FileNotFoundException |
||
35 | * @throws FileNotReadableException |
||
36 | * |
||
37 | * @return string[] |
||
38 | */ |
||
39 | public function read($file) |
||
51 | |||
52 | /** |
||
53 | * Write an array to a file. |
||
54 | * |
||
55 | * @param string $file Path to the file. |
||
56 | * @param string[] $lines Array of lines to write to the file. |
||
57 | * |
||
58 | * @throws FileNotFoundException |
||
59 | * @throws FileNotWritableException |
||
60 | */ |
||
61 | public function write($file, $lines) |
||
74 | |||
75 | /** |
||
76 | * Check whether a file exists. |
||
77 | * |
||
78 | * @param string $file Path to the file. |
||
79 | * |
||
80 | * @return bool |
||
81 | */ |
||
82 | public function exists($file) |
||
86 | |||
87 | /** |
||
88 | * Check whether a file exists and is readable. |
||
89 | * |
||
90 | * @param string $file Path to the file. |
||
91 | * |
||
92 | * @return bool |
||
93 | */ |
||
94 | public function readable($file) |
||
98 | |||
99 | /** |
||
100 | * Check whether a file exists and is writable. |
||
101 | * |
||
102 | * @param string $file Path to the file. |
||
103 | * |
||
104 | * @return bool |
||
105 | */ |
||
106 | public function writable($file) |
||
110 | } |
||
111 |