1 | <?php |
||
6 | class Local implements ContainerInterface |
||
7 | { |
||
8 | protected $baseDirectory; |
||
9 | |||
10 | 20 | public function __construct($baseDirectory) |
|
15 | |||
16 | 20 | protected function normalizePath($path) |
|
22 | |||
23 | 20 | protected function ensureDirectory($directory):bool |
|
31 | |||
32 | /** |
||
33 | * Check if the container is writable |
||
34 | */ |
||
35 | 20 | public function isWritable():bool |
|
39 | |||
40 | /** |
||
41 | * This will check if a file is in the container |
||
42 | * |
||
43 | * @param string $file |
||
44 | * @return bool |
||
45 | */ |
||
46 | 10 | public function has($file):bool |
|
50 | |||
51 | /** |
||
52 | * Saves the $content string as a file |
||
53 | * |
||
54 | * @param string $file |
||
55 | * @param string $content |
||
56 | * @return bool |
||
57 | */ |
||
58 | 11 | public function save($file, $content):bool |
|
68 | |||
69 | /** |
||
70 | * Delete the file from the container |
||
71 | * |
||
72 | * @param string $file |
||
73 | * @return bool |
||
74 | */ |
||
75 | 6 | public function delete($file):bool |
|
84 | |||
85 | /** |
||
86 | * Moves a temporary uploaded file to a destination in the container |
||
87 | * |
||
88 | * @param string $localFile local path |
||
89 | * @param string $destination |
||
90 | * @return bool |
||
91 | */ |
||
92 | 11 | public function moveUploadedFile($localFile, $destination):bool |
|
105 | } |
||
106 |
If you suppress an error, we recommend checking for the error condition explicitly: