Automattic\WooCommerce\Internal\BatchProcessing
BatchProcessingController::enqueued_list_needs_update
Determine whether the stored enqueued-processors list needs to be rewritten to include a given processor or to heal pre-existing corruption (duplicates or non-string entries).
Метод класса: BatchProcessingController{}
Хуков нет.
Возвращает
bool. True if the list should be rewritten, false if it is already clean and contains the processor.
Использование
// private - только в коде основоного (родительского) класса $result = $this->enqueued_list_needs_update( $processors, $processor_class_name ): bool;
- $processors(массив) (обязательный)
- Current list of enqueued processors.
- $processor_class_name(строка) (обязательный)
- Fully qualified class name of the processor to ensure is enqueued.
Список изменений
| С версии 11.0.0 | Введена. |
Код BatchProcessingController::enqueued_list_needs_update() BatchProcessingController::enqueued list needs update WC 11.1.1
private function enqueued_list_needs_update( array $processors, string $processor_class_name ): bool {
$seen = array();
$contains_class = false;
foreach ( $processors as $value ) {
if ( ! is_string( $value ) || isset( $seen[ $value ] ) ) {
// Non-string entry or duplicate: the list needs healing.
return true;
}
$seen[ $value ] = true;
if ( $value === $processor_class_name ) {
$contains_class = true;
}
}
return ! $contains_class;
}