Completed
Push — 677-feature/add-wp-cli-support ( 54d18b )
by
unknown
05:35
created

DeletePostsByCategoryModule::initialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 10
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 11
ccs 11
cts 11
cp 1
crap 1
rs 9.9332
1
<?php
2
3
namespace BulkWP\BulkDelete\Core\Posts\Modules;
4
5 1
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
6
7
/**
8
 * Delete Posts by Category Module. This class is kept to run the old cron jobs.
9
 *
10
 * @since 6.0.0
11
 * @since 6.1.0 Deprecated.
12
 */
13
class DeletePostsByCategoryModule extends DeletePostsByTaxonomyModule {
14
	// phpcs:ignore Squiz.Commenting.FunctionComment.Missing
15 11
	protected function build_query( $options ) {
16 11
		$query = array();
17 11
		if ( in_array( 'all', $options['selected_cats'], true ) ) {
18 2
			$query['category__not__in'] = array( 0 );
19
		} else {
20 9
			$query['category__in'] = $options['selected_cats'];
21
		}
22
23 11
		return $query;
24
	}
25
}
26