Showing 63 of 63 total issues
Function deactivate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function deactivate( $network_wide ) {
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
if ( $network_wide ) {
- 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 simple_search
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function simple_search( $term, \WP_User_Query $WP_User_Query ) {
$fields = isset( $_GET['filter']['qFields'] ) ? $_GET['filter']['qFields'] : array();
$fields = is_array( $fields ) ? $fields : array( $fields );
$search_columns = $meta_query = $user_query_ids = $usermeta_query_ids = array();
- 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 create_order_note_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static public function create_order_note_data( $data, $order_id ) {
if ( ! isset( $data['email'] ) ) {
return $data;
}
- 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 order_add_product
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function order_add_product( $order_id, $item_id, $product, $qty, $args ) {
Method update_post_metadata
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function update_post_metadata( $null, $order_id, $meta_key, $meta_value, $prev_value ) {
Function load_enabled_gateways
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function load_enabled_gateways() {
$gateways = $this->load_gateways();
$enabled = $this->get_enabled_gateway_ids();
$default = $this->get( 'default_gateway' );
$enabled_gateways = array();
- 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 process_payment
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function process_payment( $order_id, $data ) {
if ( ! isset( $data['payment_details'] ) ) {
return;
}
- 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 order_add_shipping
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function order_add_shipping( $order_id, $item_id, $rate ) {
$shipping_line = $this->get_shipping_line( $rate, $item_id );
if ( $shipping_line && isset( $shipping_line['tax'] ) ) {
$taxes = array();
- 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_settings
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function get_settings( $id = '', $wcpos_admin = null, $defaults = false ) {
// @todo remove this special hack for 'restore default settings'
if ( $defaults ) {
return $this->delete_settings( $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
Avoid too many return
statements within this method. Open
return new \WP_Error(
'woocommerce_pos_settings_error',
sprintf( __( 'No handler found for %s settings', 'woocommerce-pos' ), $id ),
array( 'status' => 400 )
);
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return $transient;
Function init
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function init() {
// Check for min requirements to run
if ( $this->php_check() && $this->woocommerce_check() ) {
// check permalinks
- 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 update_check
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function update_check( $transient, $force = false ) {
$locale = get_locale();
// pre_set_site_transient_update_plugins is called twice
// we only want to act on the second run
- 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 admin_notices
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function admin_notices() {
$notices = apply_filters( 'woocommerce_pos_admin_notices', self::$notices );
if ( empty( $notices ) ) {
return;
}
- 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_settings_handler
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function get_settings_handler( $id ) {
if ( ! $id ) {
return new \WP_Error(
'woocommerce_pos_settings_error',
- 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 remove_pos_capability
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static private function remove_pos_capability() {
$roles = array( 'administrator', 'shop_manager' );
$caps = array( 'manage_woocommerce_pos', 'access_woocommerce_pos' );
foreach ( $roles as $slug ) :
$role = get_role( $slug );
- 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"