1 | <?php |
||
2 | class unlink_directory { |
||
3 | |||
4 | function remove_directory( $directory ) { |
||
0 ignored issues
–
show
|
|||
5 | if ( isset( $directory ) ) { |
||
6 | foreach ( glob( "{$directory}/*" ) as $file ) { |
||
7 | if ( is_dir( $file ) ) { |
||
8 | $this->remove_directory( $file ); |
||
9 | } else { |
||
10 | unlink( $file ); |
||
11 | } |
||
12 | } |
||
13 | rmdir( $directory ); |
||
14 | } |
||
15 | } |
||
16 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.