lightspeeddevelopment/wetu-importer

View on GitHub

Showing 14 of 609 total issues

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 process_ajax_search has a Cognitive Complexity of 95 (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'] ) && 'destination' === $_POST['type'] ) {

Severity: Minor
Found in classes/class-lsx-wetu-importer-destination.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 process_ajax_search has a Cognitive Complexity of 93 (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'] ) && 'accommodation' === $_POST['type'] ) {

Severity: Minor
Found in classes/class-lsx-wetu-importer-accommodation.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 import_row has a Cognitive Complexity of 69 (exceeds 25 allowed). Consider refactoring.
Open

    public function import_row( $data, $wetu_id, $id = 0, $team_members = false, $importable_content = array(), $safari_brands = false ) {
        if ( 'Destination' === trim( $data[0]['type'] ) || 'Area' === trim( $data[0]['type'] ) ) {
            $post_name         = '';
            $data_post_content = '';
            $data_post_excerpt = '';
Severity: Minor
Found in classes/class-lsx-wetu-importer-destination.php - About 7 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

Function pins_sync_action has a Cognitive Complexity of 68 (exceeds 25 allowed). Consider refactoring.
Open

    public function pins_sync_action( $item_id = '', $gallery = false ) {
        $return     = false;
        $importable = array();

        if ( '' !== $item_id && false !== $item_id ) {
Severity: Minor
Found in classes/class-wetu-automation.php - About 7 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 has 48 functions (exceeds 25 allowed). Consider refactoring.
Open

class LSX_WETU_Importer {

    /**
     * Holds class instance
     *
Severity: Minor
Found in classes/class-lsx-wetu-importer.php - About 5 hrs to fix

    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

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

          public function create_main_gallery( $data, $id ) {
              if ( is_array( $data[0]['content']['images'] ) && ! empty( $data[0]['content']['images'] ) ) {
                  if ( isset( $this->options['image_replacing'] ) && 'on' === $this->options['image_replacing'] ) {
                      $current_gallery = get_post_meta( $id, 'gallery', false );
      
      
      Severity: Minor
      Found in classes/class-lsx-wetu-importer.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

      Function import_row has a Cognitive Complexity of 39 (exceeds 25 allowed). Consider refactoring.
      Open

          public function import_row( $data, $wetu_id, $id = 0, $team_members = false, $importable_content = array(), $safari_brands = false ) {
              $post_name         = '';
              $data_post_content = '';
              $data_post_excerpt = '';
      
      
      Severity: Minor
      Found in classes/class-lsx-wetu-importer-accommodation.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

      Function lsx_wetu_get_post_count has a Cognitive Complexity of 35 (exceeds 25 allowed). Consider refactoring.
      Open

      function lsx_wetu_get_post_count( $post_type = '', $post_status = '' ) {
          global $wpdb;
          $count = '0';
          if ( '' !== $post_type && '' !== $post_status ) {
              $result = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(`ID`) FROM $wpdb->posts WHERE `post_status` = '%s' AND `post_type` = '%s'", array( trim( $post_status ), $post_type ) ) );
      Severity: Minor
      Found in includes/helpers.php - About 1 hr 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 display_page has a Cognitive Complexity of 34 (exceeds 25 allowed). Consider refactoring.
      Open

          public function display_page() {
              $options = lsx_wetu_get_options();
              foreach ( $options as $key => $value ) {
                  $value = trim( $value );
              }
      Severity: Minor
      Found in classes/class-lsx-wetu-importer-settings.php - About 1 hr 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

      Severity
      Category
      Status
      Source
      Language