Code Duplication    Length = 13-13 lines in 2 locations

classes/salesforce_mapping.php 2 locations

@@ 503-515 (lines=13) @@
500
		if ( ! empty( $conditions ) ) { // get multiple but with a limitation.
501
			$mappings = array();
502
503
			if ( ! empty( $conditions ) ) {
504
				$where = ' WHERE ';
505
				$i     = 0;
506
				foreach ( $conditions as $key => $value ) {
507
					$i++;
508
					if ( $i > 1 ) {
509
						$where .= ' AND ';
510
					}
511
					$where .= '`' . $key . '` = "' . $value . '"';
512
				}
513
			} else {
514
				$where = '';
515
			}
516
517
			$mappings = $this->wpdb->get_results( 'SELECT * FROM ' . $table . $where . $order, ARRAY_A );
518
		} else { // get all of the mappings. ALL THE MAPPINGS.
@@ 541-553 (lines=13) @@
538
		if ( ! empty( $conditions ) ) { // get multiple but with a limitation.
539
			$mappings = array();
540
541
			if ( ! empty( $conditions ) ) {
542
				$where = ' WHERE ';
543
				$i     = 0;
544
				foreach ( $conditions as $key => $value ) {
545
					$i++;
546
					if ( $i > 1 ) {
547
						$where .= ' AND ';
548
					}
549
					$where .= '`' . $key . '` = "' . $value . '"';
550
				}
551
			} else {
552
				$where = '';
553
			}
554
555
			$mappings = $this->wpdb->get_results( 'SELECT * FROM ' . $table . $where . $order, ARRAY_A );
556
			if ( ! empty( $mappings ) && 1 === $this->wpdb->num_rows ) {