File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,16 @@ public function getDefaultUrlFormatter(): string
4848 return $ formatter ;
4949 }
5050
51+ public function dirname (): ?string
52+ {
53+
54+ if ($ this ->path ) {
55+ return dirname ($ this ->path );
56+ }
57+
58+ return null ;
59+ }
60+
5161 public function getDisk (): ?Filesystem
5262 {
5363 if (! $ this ->disk ) {
@@ -133,6 +143,23 @@ public function deleteFile(): bool
133143 return true ;
134144 }
135145
146+ public function deleteDirectory (): bool
147+ {
148+ $ dirname = $ this ->dirname ();
149+
150+ if (! $ dirname ) {
151+ return true ;
152+ }
153+
154+ $ filesystem = $ this ->getDisk ();
155+
156+ if (! $ filesystem ) {
157+ return true ;
158+ }
159+
160+ return $ filesystem ->deleteDirectory ($ dirname );
161+ }
162+
136163 /**
137164 * @return ?string The new file path on success, null on failure
138165 */
You can’t perform that action at this time.
0 commit comments