Bulk_Task allows the progress bar to be omitted, but because Progress is an interface, it's also possible to implement the null object pattern. I'd like to be able to use a null progress bar to be able to still use dependency injection in my codebase even when I don't want a progress bar to appear. For example:
new Bulk_Task(
'audit-blocks',
get_flag_value( $assoc_args, 'verbose', false )
? new PHP_CLI_Progress_Bar( 'Bulk Task: audit-blocks' )
: new Null_Progress_Bar(),
);
However, since not all codebases rely on DI, I haven't changed the nullable nature of the Progress parameter.
Bulk_Task
allows the progress bar to be omitted, but becauseProgress
is an interface, it's also possible to implement the null object pattern. I'd like to be able to use a null progress bar to be able to still use dependency injection in my codebase even when I don't want a progress bar to appear. For example:However, since not all codebases rely on DI, I haven't changed the nullable nature of the
Progress
parameter.