includes/class.llms.ajax.php
Method query_quiz_questions
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function query_quiz_questions() {
// Grab the search term if it exists.
$term = array_key_exists( 'term', $_REQUEST ) ? llms_filter_input_sanitize_string( INPUT_POST, 'term' ) : '';
$page = array_key_exists( 'page', $_REQUEST ) ? llms_filter_input( INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT ) : 0;
Function favorite_object
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
public function favorite_object() {
// Grab the data if it exists.
$user_action = llms_filter_input_sanitize_string( INPUT_POST, 'user_action' );
$object_id = llms_filter_input( INPUT_POST, 'object_id', FILTER_SANITIZE_NUMBER_INT );
- 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 favorite_object
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function favorite_object() {
// Grab the data if it exists.
$user_action = llms_filter_input_sanitize_string( INPUT_POST, 'user_action' );
$object_id = llms_filter_input( INPUT_POST, 'object_id', FILTER_SANITIZE_NUMBER_INT );