Function handle_manage_addons
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function handle_manage_addons() {
// phpcs:disable WordPress.Security.NonceVerification.Missing -- nonce is verified in $this->handle_actions() method.
$actions = apply_filters(
- 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 output
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function output() {
if ( is_wp_error( $this->get_data() ) ) {
_e( 'There was an error retrieving add-ons. Please try again.', 'lifterlms' );
return;
Method handle_manage_addons
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function handle_manage_addons() {
// phpcs:disable WordPress.Security.NonceVerification.Missing -- nonce is verified in $this->handle_actions() method.
$actions = apply_filters(
Function get_data
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function get_data() {
$this->data = llms_get_add_ons();
if ( ! is_wp_error( $this->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
Function get_products_for_cat
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function get_products_for_cat( $cat, $include_bundles = true ) {
$products = array();
foreach ( $this->data['items'] as $item ) {
- 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_product_from_cat
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function get_product_from_cat( $cat, $excludes ) {
$addons = $this->get_products_for_cat( $cat, true );
shuffle( $addons );
- 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"