Automattic\WooCommerce\Internal\CLI\Migrator\Core
ProductsController::display_saved_arguments
Display the saved arguments from a previous session.
Метод класса: ProductsController{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->display_saved_arguments( $args ): void;
- $args(массив) (обязательный)
- The saved arguments to display.
Код ProductsController::display_saved_arguments() ProductsController::display saved arguments WC 10.5.2
private function display_saved_arguments( array $args ): void {
$important_args = array(
'platform' => 'Platform',
'limit' => 'Product Limit',
'batch_size' => 'Batch Size',
'skip_existing' => 'Skip Existing',
'dry_run' => 'Dry Run',
'verbose' => 'Verbose',
'assign_default_category' => 'Assign Default Category',
);
foreach ( $important_args as $key => $label ) {
if ( isset( $args[ $key ] ) ) {
$value = $args[ $key ];
if ( is_bool( $value ) ) {
$value = $value ? 'Yes' : 'No';
} elseif ( is_array( $value ) ) {
$value = implode( ', ', $value );
} elseif ( 'limit' === $key && PHP_INT_MAX === (int) $value ) {
$value = 'All';
}
WP_CLI::line( sprintf( ' %s: %s', $label, $value ) );
}
}
if ( ! empty( $args['filters'] ) && is_array( $args['filters'] ) ) {
WP_CLI::line( ' Filters:' );
foreach ( $args['filters'] as $filter_key => $filter_value ) {
if ( is_array( $filter_value ) ) {
$filter_value = implode( ', ', $filter_value );
}
WP_CLI::line( sprintf( ' %s: %s', $filter_key, $filter_value ) );
}
}
if ( ! empty( $args['fields'] ) && is_array( $args['fields'] ) ) {
WP_CLI::line( sprintf( ' Fields: %s', implode( ', ', $args['fields'] ) ) );
}
}