File class-wc-helper-updater.php
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* The update helper for WooCommerce.com plugins.
*
* @class WC_Helper_Updater
Method get_translations_update_data
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function get_translations_update_data() {
$payload = array();
$installed_translations = wp_get_installed_translations( 'plugins' );
Function get_translations_update_data
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public static function get_translations_update_data() {
$payload = array();
$installed_translations = wp_get_installed_translations( 'plugins' );
- 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_updates_count
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function get_updates_count() {
$cache_key = '_woocommerce_helper_updates_count';
$count = get_transient( $cache_key );
if ( false !== $count ) {
return $count;
- 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_updates_count
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function get_updates_count() {
$cache_key = '_woocommerce_helper_updates_count';
$count = get_transient( $cache_key );
if ( false !== $count ) {
return $count;
Method transient_update_plugins
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function transient_update_plugins( $transient ) {
$update_data = self::get_update_data();
foreach ( WC_Helper::get_local_woo_plugins() as $plugin ) {
if ( empty( $update_data[ $plugin['_product_id'] ] ) ) {
Function transient_update_plugins
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function transient_update_plugins( $transient ) {
$update_data = self::get_update_data();
foreach ( WC_Helper::get_local_woo_plugins() as $plugin ) {
if ( empty( $update_data[ $plugin['_product_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
Method _update_check
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function _update_check( $payload ) {
ksort( $payload );
$hash = md5( wp_json_encode( $payload ) );
$cache_key = '_woocommerce_helper_updates';
Function _has_active_subscription
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private static function _has_active_subscription( $product_id ) {
if ( ! isset( $auth ) ) {
$auth = WC_Helper_Options::get( 'auth' );
}
- 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 transient_update_themes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function transient_update_themes( $transient ) {
$update_data = self::get_update_data();
foreach ( WC_Helper::get_local_woo_themes() as $theme ) {
if ( empty( $update_data[ $theme['_product_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 get_update_data
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function get_update_data() {
$payload = array();
// Scan subscriptions.
foreach ( WC_Helper::get_subscriptions() as $subscription ) {
- 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 $translations;
Avoid too many return
statements within this method. Open
return $count;
Avoid too many return
statements within this method. Open
return array();