Showing 156 of 191 total issues
File class-llms-rest-access-plans-controller.php
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* REST Access Plans Controller
*
* @package LifterLMS_REST/Classes/Controllers
Function prepare_item_for_database
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
protected function prepare_item_for_database( $request ) {
$prepared_item = array();
// LLMS Post ID.
- 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
LLMS_REST_Enrollments_Controller
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class LLMS_REST_Enrollments_Controller extends LLMS_REST_Controller {
/**
* Route base.
*
Function prepare_item_for_database
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
protected function prepare_item_for_database( $request ) {
$prepared_item = parent::prepare_item_for_database( $request );
$schema = $this->get_item_schema();
- 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_objects_query
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_objects_query( $query_args, $request = null ) {
global $wpdb;
// Maybe limit the query results depending on the page param.
Function prepare_collection_query_search_args
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
protected function prepare_collection_query_search_args( $prepared, $request ) {
// Search?
if ( ! empty( $prepared['search'] ) ) {
- 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 update_additional_object_fields
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function update_additional_object_fields( $access_plan, $request, $schema, $prepared_item, $creating = true ) {
$error = new WP_Error();
// Will contain the properties to set.
LLMS_REST_Controller
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class LLMS_REST_Controller extends LLMS_REST_Controller_Stubs {
/**
* Endpoint namespace.
*
Function prepare_item_for_database
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
protected function prepare_item_for_database( $request ) {
$prepared_item = parent::prepare_item_for_database( $request );
$schema = $this->get_item_schema();
- 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
File class-llms-rest-webhooks.php
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* CRUD Webhooks
*
* @package LifterLMS_REST/Classes
Method get_item_schema_base
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_item_schema_base() {
return array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'webhook',
Method prepare_object_for_response
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function prepare_object_for_response( $course, $request ) {
$data = parent::prepare_object_for_response( $course, $request );
// Catalog visibility.
Function get_fields
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public static function get_fields() {
require_once 'tables/class-llms-rest-table-api-keys.php';
$add_key = '1' === llms_filter_input( INPUT_GET, 'add-key', 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 prepare_item_for_database
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function prepare_item_for_database( $request ) {
$prepared_item = parent::prepare_item_for_database( $request );
$schema = $this->get_item_schema();
Method prepare_item_for_database
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function prepare_item_for_database( $request ) {
$prepared_item = array();
// LLMS Post ID.
File class-llms-rest-students-progress-controller.php
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* REST Controller for Student Progress.
*
* @package LifterLMS_REST/Classes
Method update_additional_object_fields
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function update_additional_object_fields( $membership, $request, $schema, $prepared_item, $creating = true ) {
$error = new WP_Error();
// Auto enroll.
if ( ! empty( $schema['properties']['auto_enroll'] ) && isset( $request['auto_enroll'] ) ) {
LLMS_REST_API_Keys_Controller
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class LLMS_REST_API_Keys_Controller extends LLMS_REST_Controller {
/**
* Route base.
*
Method prepare_item_for_database
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function prepare_item_for_database( $request ) {
$prepared_item = parent::prepare_item_for_database( $request );
$schema = $this->get_item_schema();
Function is_valid_resource
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
protected function is_valid_resource( $args ) {
$resource = $this->get_resource();
if ( in_array( $resource, LLMS_REST_API()->webhooks()->get_post_type_resources(), true ) ) {
- 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"