load_bulk_delete_addon()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
nc 1
nop 2
dl 0
loc 10
ccs 0
cts 6
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
/**
3
 * Add-on helper functions.
4
 *
5
 * These functions are not using namespace since they may be used from a PHP 5.2 file.
6
 *
7
 * @since 6.0.0
8
 */
9
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
10
11
/**
12
 * Load an Bulk Delete add-on.
13
 *
14
 * @since 6.0.0
15
 *
16
 * @param string $addon_class   Add-on class name.
17
 * @param array  $addon_details Add-on Details.
18
 *
19
 * @return \BulkWP\BulkDelete\Addon\BaseAddon Instance of the add-on.
0 ignored issues
show
Bug introduced by
The type BulkWP\BulkDelete\Addon\BaseAddon was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
 */
21
function load_bulk_delete_addon( $addon_class, $addon_details ) {
22
	$addon_info = new \BulkWP\BulkDelete\Core\Addon\AddonInfo( $addon_details );
23
24
	$bulk_delete = \BulkWP\BulkDelete\Core\BulkDelete::get_instance();
25
	$bulk_delete->register_addon_namespace( $addon_info );
26
27
	$addon = new $addon_class( $addon_info );
28
	add_action( 'bd_loaded', array( $addon, 'register' ) );
29
30
	return $addon;
31
}
32