includes/class-woocommerce.php
File class-woocommerce.php
has 473 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* WooCommerce setup
*
* @package WooCommerce
WooCommerce
has 45 functions (exceeds 20 allowed). Consider refactoring. Open
Open
final class WooCommerce {
/**
* WooCommerce version.
*
Method includes
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function includes() {
/**
* Class autoloader.
*/
include_once WC_ABSPATH . 'includes/class-wc-autoloader.php';
Function theme_support_includes
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
private function theme_support_includes() {
if ( wc_is_wp_default_theme_active() ) {
switch ( get_template() ) {
case 'twentyten':
include_once WC_ABSPATH . 'includes/theme-support/class-wc-twenty-ten.php';
- 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 theme_support_includes
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function theme_support_includes() {
if ( wc_is_wp_default_theme_active() ) {
switch ( get_template() ) {
case 'twentyten':
include_once WC_ABSPATH . 'includes/theme-support/class-wc-twenty-ten.php';
Function api_request_url
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
public function api_request_url( $request, $ssl = null ) {
if ( is_null( $ssl ) ) {
$scheme = wp_parse_url( home_url(), PHP_URL_SCHEME );
} elseif ( $ssl ) {
$scheme = 'https';
- 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"