Passed
Push — analysis-zdQEvv ( 06106c )
by Sudar
69:09 queued 46s
created

DeletePostsByCategoryModule::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
nc 1
nop 0
dl 0
loc 1
ccs 0
cts 0
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace BulkWP\BulkDelete\Core\Posts\Modules;
4
5
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
	protected function build_query( $options ) {
16
		$query = array();
17
		if ( in_array( 'all', $options['selected_cats'], true ) ) {
18
			$query['category__not__in'] = array( 0 );
19
		} else {
20
			$query['category__in'] = $options['selected_cats'];
21
		}
22
23
		return $query;
24
	}
25
}
26