File class-wc-install.php
has 1141 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Installation related functions and actions.
*
* @package WooCommerce\Classes
Method get_schema
has 220 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function get_schema() {
global $wpdb;
$collate = '';
WC_Install
has 43 functions (exceeds 20 allowed). Consider refactoring. Open
class WC_Install {
/**
* DB updates and callbacks that need to be run per version.
*
Function background_installer
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public static function background_installer( $plugin_to_install_id, $plugin_to_install ) {
// Explicitly clear the event.
$args = func_get_args();
if ( ! empty( $plugin_to_install['repo-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"
Further reading
Method background_installer
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function background_installer( $plugin_to_install_id, $plugin_to_install ) {
// Explicitly clear the event.
$args = func_get_args();
if ( ! empty( $plugin_to_install['repo-slug'] ) ) {
Method create_roles
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function create_roles() {
global $wp_roles;
if ( ! class_exists( 'WP_Roles' ) ) {
return;
Function create_terms
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function create_terms() {
$taxonomies = array(
'product_type' => array(
'simple',
'grouped',
- 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_options
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private static function create_options() {
// Include settings so that we can run through defaults.
include_once dirname( __FILE__ ) . '/admin/class-wc-admin-settings.php';
$settings = WC_Admin_Settings::get_settings_pages();
- 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 create_terms
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function create_terms() {
$taxonomies = array(
'product_type' => array(
'simple',
'grouped',
Method theme_background_installer
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function theme_background_installer( $theme_slug ) {
// Explicitly clear the event.
$args = func_get_args();
if ( ! empty( $theme_slug ) ) {
Method create_tables
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function create_tables() {
global $wpdb;
$wpdb->hide_errors();
Function create_tables
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private static function create_tables() {
global $wpdb;
$wpdb->hide_errors();
- 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 create_files
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function create_files() {
// Bypass if filesystem is read-only and/or non-standard upload system is used.
if ( apply_filters( 'woocommerce_install_skip_create_files', false ) ) {
return;
}
Method create_placeholder_image
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function create_placeholder_image() {
$placeholder_image = get_option( 'woocommerce_placeholder_image', 0 );
// Validate current setting if set. If set, return.
if ( ! empty( $placeholder_image ) ) {
Method create_pages
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function create_pages() {
include_once dirname( __FILE__ ) . '/admin/wc-admin-functions.php';
$pages = apply_filters(
'woocommerce_create_pages',
Method get_core_capabilities
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function get_core_capabilities() {
$capabilities = array();
$capabilities['core'] = array(
'manage_woocommerce',
Function theme_background_installer
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function theme_background_installer( $theme_slug ) {
// Explicitly clear the event.
$args = func_get_args();
if ( ! empty( $theme_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"
Further reading
Function verify_base_tables
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function verify_base_tables( $modify_notice = true, $execute = false ) {
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
if ( $execute ) {
self::create_tables();
- 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_files
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function create_files() {
// Bypass if filesystem is read-only and/or non-standard upload system is used.
if ( apply_filters( 'woocommerce_install_skip_create_files', false ) ) {
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 create_placeholder_image
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function create_placeholder_image() {
$placeholder_image = get_option( 'woocommerce_placeholder_image', 0 );
// Validate current setting if set. If set, return.
if ( ! empty( $placeholder_image ) ) {
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static function update() {
$current_db_version = get_option( 'woocommerce_db_version' );
$loop = 0;
foreach ( self::get_db_update_callbacks() as $version => $update_callbacks ) {
- 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"