File class-sv-wp-background-job-handler.php
has 401 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WooCommerce Plugin Framework
*
* This source file is subject to the GNU General Public License v3.0
SV_WP_Background_Job_Handler
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
#[\AllowDynamicProperties]
abstract class SV_WP_Background_Job_Handler extends SV_WP_Async_Request {
/** @var string async request prefix */
Function process_job
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function process_job( $job, $items_per_batch = null ) {
if ( ! $this->start_time ) {
$this->start_time = time();
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method process_job
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process_job( $job, $items_per_batch = null ) {
if ( ! $this->start_time ) {
$this->start_time = time();
}
Method get_jobs
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_jobs( $args = array() ) {
global $wpdb;
$args = wp_parse_args( $args, array(
'order' => 'DESC',
Function get_jobs
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function get_jobs( $args = array() ) {
global $wpdb;
$args = wp_parse_args( $args, array(
'order' => 'DESC',
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method get_job
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_job( $id = null ) {
global $wpdb;
if ( ! $id ) {
Function get_job
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function get_job( $id = null ) {
global $wpdb;
if ( ! $id ) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function maybe_handle
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function maybe_handle() {
if ( $this->is_process_running() ) {
// background process already running
wp_die();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function fail_job
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function fail_job( $job, $reason = '' ) {
if ( is_string( $job ) ) {
$job = $this->get_job( $job );
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_memory_limit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function get_memory_limit() {
if ( function_exists( 'ini_get' ) ) {
$memory_limit = ini_get( 'memory_limit' );
} else {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"