File class-wc-template-loader.php
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Template Loader
*
* @package WooCommerce\Classes
Method unsupported_theme_tax_archive_init
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function unsupported_theme_tax_archive_init() {
global $wp_query, $post;
$queried_object = get_queried_object();
$args = self::get_current_shop_view_args();
Function get_template_loader_files
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static function get_template_loader_files( $default_file ) {
$templates = apply_filters( 'woocommerce_template_loader_files', array(), $default_file );
$templates[] = 'woocommerce.php';
if ( is_page_template() ) {
- 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_template_loader_files
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function get_template_loader_files( $default_file ) {
$templates = apply_filters( 'woocommerce_template_loader_files', array(), $default_file );
$templates[] = 'woocommerce.php';
if ( is_page_template() ) {
Method unsupported_theme_shop_content_filter
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function unsupported_theme_shop_content_filter( $content ) {
global $wp_query;
if ( self::$theme_support || ! is_main_query() || ! in_the_loop() ) {
return $content;
Function template_loader
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function template_loader( $template ) {
if ( is_embed() ) {
return $template;
}
- 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_template_loader_default_file
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function get_template_loader_default_file() {
if ( is_singular( 'product' ) ) {
$default_file = 'single-product.php';
} elseif ( is_product_taxonomy() ) {
$object = get_queried_object();
- 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 unsupported_theme_tax_archive_init
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function unsupported_theme_tax_archive_init() {
global $wp_query, $post;
$queried_object = get_queried_object();
$args = self::get_current_shop_view_args();
- 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 unsupported_theme_title_filter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function unsupported_theme_title_filter( $title, $id ) {
if ( self::$theme_support || ! $id !== self::$shop_page_id ) {
return $title;
}
- 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"