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

DeletePostsByCategoryModule::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 37
Code Lines 33

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 33
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 37
ccs 0
cts 14
cp 0
crap 2
rs 9.392
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