Showing 57 of 63 total issues
Method get_receipt_template
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_receipt_template() {
$this->register_receipt_status();
$settings = wcpos_get_option( 'receipts', 'receipt_options' );
$type = isset( $settings['template_language'] ) ? $settings['template_language'] : 'html';
Method save_post
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function save_post( $post_id, $post ) {
// If this is an autosave, our form has not been submitted, so we don't want to do anything.
if ( defined( '\DOING_AUTOSAVE' ) && \DOING_AUTOSAVE ) {
return;
Method menu
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function menu() {
return apply_filters( 'woocommerce_pos_menu', array(
array(
'id' => 'pos',
Method update_post_metadata
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update_post_metadata( $null, $order_id, $meta_key, $meta_value, $prev_value ) {
// we want last update to _order_shipping after $order->calculate_taxes()
// set flag true on first pass
if ( $meta_key == '_order_shipping_tax' ) {
Function delete
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function delete() {
global $wp_roles;
$roles = $wp_roles->roles;
$caps = array_merge( $this->caps['pos'], $this->caps['woo'] );
- 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 update_check
has 31 lines of code (exceeds 25 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
Function meta_box
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function meta_box(){
var display = $('#pos-visibility-display'),
show = $('#pos-visibility-show'),
select = $('#pos-visibility-select'),
cancel = $('#pos-visibility-cancel'),
Method create_order_data
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create_order_data( array $data ) {
// add filters & actions for create order
add_filter( 'woocommerce_product_tax_class', array( $this, 'product_tax_class' ), 10, 2 );
add_filter( 'woocommerce_get_product_from_item', array( $this, 'get_product_from_item' ), 10, 3 );
Method get_external_library_locale_js
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
static public function get_external_library_locale_js( $library = '', $version = '' ) {
$cdnjs_url = $locale_js = '';
switch ( $library ) {
case 'select2':
Method get_settings_handler
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function get_settings_handler( $id ) {
if ( ! $id ) {
return new \WP_Error(
'woocommerce_pos_settings_error',
Method pos_visibility_filters
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function pos_visibility_filters( $views ) {
global $wpdb;
$visibility_filters = array(
// 'pos_and_online' => __( 'POS & Online', 'woocommerce-pos' ),
Function complex_search
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function complex_search( array $queries, \WP_User_Query $WP_User_Query ) {
$include = array();
foreach ( $queries as $query ) {
$type = isset( $query['type'] ) ? $query['type'] : '';
- 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_external_library_locale_js
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
static public function get_external_library_locale_js( $library = '', $version = '' ) {
$cdnjs_url = $locale_js = '';
switch ( $library ) {
case 'select2':
- 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 activate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function activate( $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 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"