Showing 1,420 of 1,425 total issues
File model.llms.user.certificate.php
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* LLMS_User_Certificate model class
*
* @package LifterLMS/Models/Classes
Method get_fields
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_fields() {
$voucher = new LLMS_Voucher( $this->post->ID );
$selected_couses = $voucher->get_products( 'course' );
Method set_columns
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function set_columns() {
$cols = array(
'id' => array(
'exportable' => true,
'sortable' => true,
Method llms_update_300_update_orders
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function llms_update_300_update_orders() {
$args = array(
'post_type' => array( 'llms_order' ),
'posts_per_page' => -1,
Function output_section
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function output_section( $section, $which ) {
$url = false;
if ( 'previous' === $which ) {
- 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_data
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function get_data( $key, $achievement ) {
// Handle old object being passed in.
if ( ! is_a( $achievement, 'LLMS_User_Achievement' ) && property_exists( $achievement, 'achievement_id' ) ) {
$achievement = new LLMS_User_Achievement( $achievement->certificate_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
Function get_data
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function get_data( $key, $student ) {
$value = '';
switch ( $key ) {
- 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 17 (exceeds 5 allowed). Consider refactoring. Open
protected function save( $post_id ) {
if ( ! llms_verify_nonce( 'lifterlms_meta_nonce', 'lifterlms_save_data' ) || ! current_user_can( $this->capability, $post_id ) ) {
return -1;
}
- 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 toArray
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function toArray() {
$arr = array(
'id' => $this->get( '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
Function prepare_data_for_insert
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function prepare_data_for_insert( $posted_data, $fields, $action ) {
$prepared = array();
foreach ( $fields as $field ) {
- 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 handle_caps
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function handle_caps( $allcaps, $cap, $args ) {
/**
* Modify the list of post types that users may not own but can still edit based on instructor permissions on the course
*
- 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 set_merge_data
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function set_merge_data( $code ) {
$transaction = $this->post;
$order = $transaction->get_order();
- 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 checkout
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private static function checkout( $atts ) {
// if there are membership restrictions, check the user is in at least one membership.
// this is to combat CHEATERS.
if ( $atts['plan']->has_availability_restrictions() ) {
- 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 llms_get_date_diff
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function llms_get_date_diff( $time1, $time2, $precision = 2 ) {
// If not numeric then convert timestamps.
if ( ! is_numeric( $time1 ) ) {
$time1 = strtotime( $time1 );
}
Method get_fields
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_fields() {
$post = llms_get_post( $this->post );
$defaults = llms_get_instructors_defaults();
Method get_views
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_views( $views ) {
$post_type = llms_filter_input_sanitize_string( INPUT_GET, 'post_type' );
$current_user_id = get_current_user_id();
$exclude_states = get_post_stati(
Method get_results
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_results( $args = array() ) {
$this->title = __( 'Quizzes', 'lifterlms' );
$args = $this->clean_args( $args );
Method llms_update_300_migrate_course_postmeta
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function llms_update_300_migrate_course_postmeta() {
global $wpdb;
// Rekey meta fields.
Method lifterlms_template_my_courses_loop
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function lifterlms_template_my_courses_loop( $student = null, $preview = false ) {
$student = llms_get_student( $student );
if ( ! $student ) {
return;
File class.llms.controller.orders.php
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Order processing and related actions controller.
*
* @package LifterLMS/Controllers/Classes