includes/class-llms-rest-webhooks.php
Method get_hooks
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function get_hooks() {
$hooks = array(
// Courses.
File class-llms-rest-webhooks.php
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* CRUD Webhooks
*
* @package LifterLMS_REST/Classes
Method get_topics
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function get_topics() {
/**
* Filter the available webhook topics.
*
Function is_data_valid
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function is_data_valid( $data ) {
// Validate Status.
if ( isset( $data['status'] ) && ! in_array( $data['status'], array_keys( $this->get_statuses() ), true ) ) {
// Translators: %s = Invalid permission string.
- 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 save
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function save( $obj, $data ) {
if ( isset( $data['delivery_url'] ) && ( ! $obj->exists() || $obj->exists() && $data['delivery_url'] !== $obj->get( 'delivery_url' ) ) ) {
$obj->set( 'delivery_url', $data['delivery_url'] );
$ping = $obj->ping();
- 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"