public static function recursiveUnlink(string $folder, bool $remove_folder = true): bool {

        try {

            self::emptyFolder($folder);
            if ( $remove_folder && rmdir($folder) === false ) {
                throw new Exception("Error deleting folder: $folder");
            }
            return true;

        } catch (Exception $e) {
            throw $e;
        }

    }
public static function recursiveUnlink(string $folder, bool $remove_folder = true): bool {

        try {

            self::emptyFolder($folder);
            if ( $remove_folder && rmdir($folder) === false ) {
                throw new Exception("Error deleting folder: $folder");
            }
            return true;

        } catch (Exception $e) {
            throw $e;
        }

    }
public static function recursiveUnlink ( string $ folder , bool $ remove_folder = true ) : bool { try { self :: emptyFolder ( $ folder ) ; if ( $ remove_folder && rmdir ( $ folder ) === false ) { throw new Exception ( "Error deleting folder: $folder" ) ; } return true ; } catch ( Exception $ e ) { throw $ e ; } }
Unlink a folder recursively

@param string $folder The folder to be removed
@param bool $remove_folder If true, the folder itself will be removed
@return bool
@throws Exception
Unlink a folder recursively