lightspeeddevelopment/wetu-importer

View on GitHub
classes/class-lsx-wetu-importer-tours.php

Summary

Maintainability
F
5 days
Test Coverage

Function process_itineraries has a Cognitive Complexity of 121 (exceeds 25 allowed). Consider refactoring.
Open

    public function process_itineraries( $data, $id, $importable_content ) {
        $day_counter = 1;
        $leg_counter = 0;

        // Change this to check for a parameter
Severity: Minor
Found in classes/class-lsx-wetu-importer-tours.php - About 2 days to fix

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 process_ajax_search has a Cognitive Complexity of 109 (exceeds 25 allowed). Consider refactoring.
Open

    public function process_ajax_search() {
        $return = false;
        check_ajax_referer( 'lsx_wetu_ajax_action', 'security' );

        if ( isset( $_POST['action'] ) && 'lsx_tour_importer' === $_POST['action'] && isset( $_POST['type'] ) && $_POST['type'] === $this->tab_slug ) {
Severity: Minor
Found in classes/class-lsx-wetu-importer-tours.php - About 1 day to fix

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 attach_destination_images has a Cognitive Complexity of 47 (exceeds 25 allowed). Consider refactoring.
Open

    public function attach_destination_images( $importable_content = array() ) {
        if ( false !== $this->destination_images ) {
            $this->shuffle_assoc( $this->destination_images );
            foreach ( $this->destination_images as $tour => $destinations ) {
                shuffle( $destinations );
Severity: Minor
Found in classes/class-lsx-wetu-importer-tours.php - About 3 hrs to fix

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

LSX_WETU_Importer_Tours has 35 functions (exceeds 25 allowed). Consider refactoring.
Open

class LSX_WETU_Importer_Tours extends LSX_WETU_Importer {

    /**
     * The url to list items from WETU
     *
Severity: Minor
Found in classes/class-lsx-wetu-importer-tours.php - About 3 hrs to fix

    Function set_destination has a Cognitive Complexity of 41 (exceeds 25 allowed). Consider refactoring.
    Open

        public function set_destination( $day, $id, $leg_counter ) {
            $dest_id    = false;
            $country_id = false;
    
            $this->current_destinations = $this->find_current_destinations();
    Severity: Minor
    Found in classes/class-lsx-wetu-importer-tours.php - About 2 hrs to fix

    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

    There are no issues that match your filters.

    Category
    Status