Showing 156 of 191 total issues
File class-llms-rest-posts-controller.php
has 936 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* REST LLMS Posts Controller Class
*
* @package LifterLMS_REST/Abstracts
File class-llms-rest-courses-controller.php
has 801 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* REST Courses Controller
*
* @package LifterLMS_REST/Classes/Controllers
Method get_item_schema_base
has 345 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_item_schema_base() {
$schema = (array) parent::get_item_schema_base();
$course_properties = array(
File class-llms-rest-enrollments-controller.php
has 624 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* REST Enrollments Controller.
*
* @package LLMS_REST
Function update_additional_object_fields
has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring. Open
protected function update_additional_object_fields( $course, $request, $schema, $prepared_item, $creating = true ) {
$error = new WP_Error();
// Course catalog visibility.
- 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_item_schema_base
has 184 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_item_schema_base() {
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => $this->post_type,
File class-llms-rest-controller.php
has 456 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Base REST Controller
*
* @package LifterLMS_REST/Abstracts
Method get_item_schema_base
has 163 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_item_schema_base() {
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => $this->resource_name,
LLMS_REST_Posts_Controller
has 47 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class LLMS_REST_Posts_Controller extends LLMS_REST_Controller {
/**
* Post type.
*
Method get_fields
has 156 lines of code (exceeds 25 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 );
File class-llms-rest-lessons-controller.php
has 420 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* REST Lessons Controller
*
* @package LifterLMS_REST/Classes/Controllers
Method get_item_schema_base
has 152 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_item_schema_base() {
$schema = (array) parent::get_item_schema_base();
$schema['properties']['auto_enroll'] = array(
File class-llms-rest-users-controller.php
has 417 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Base users controller class
*
* @package LifterLMS_REST/Abstracts
Method get_item_schema_base
has 147 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_item_schema_base() {
$schema = (array) parent::get_item_schema_base();
$lesson_properties = array(
File class-llms-rest-memberships-controller.php
has 402 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* REST Memberships Controller
*
* @package LifterLMS_REST/Classes/Controllers
Function update_additional_object_fields
has a Cognitive Complexity of 35 (exceeds 5 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'] ) ) {
- 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 update_additional_object_fields
has a Cognitive Complexity of 33 (exceeds 5 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.
- 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 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function update_additional_object_fields( $course, $request, $schema, $prepared_item, $creating = true ) {
$error = new WP_Error();
// Course catalog visibility.
Method get_hooks
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_hooks() {
$hooks = array(
// Courses.
Method get_fields
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function get_fields() {
require_once 'tables/class-llms-rest-table-webhooks.php';
$add_hook = '1' === llms_filter_input( INPUT_GET, 'add-webhook', FILTER_SANITIZE_NUMBER_INT );