Code Duplication    Length = 25-25 lines in 2 locations

classes/Pods.php 2 locations

@@ 2593-2617 (lines=25) @@
2590
					}//end if
2591
2592
					if ( empty( $key ) ) {
2593
						if ( ! in_array( $this->pod_data['type'], array( 'pod', 'table' ), true ) ) {
2594
							if ( isset( $this->pod_data['object_fields'][ $k ] ) ) {
2595
								$key = "`t`.`{$k}`";
2596
							} elseif ( isset( $this->fields[ $k ] ) ) {
2597
								if ( 'table' === $this->pod_data['storage'] ) {
2598
									$key = "`d`.`{$k}`";
2599
								} else {
2600
									$key = "`{$k}`.`meta_value`";
2601
								}
2602
							} else {
2603
								$object_fields = (array) $this->pod_data['object_fields'];
2604
2605
								foreach ( $object_fields as $object_field => $object_field_opt ) {
2606
									if ( $object_field === $k || in_array( $k, $object_field_opt['alias'], true ) ) {
2607
										$key = "`t`.`{$object_field}`";
2608
									}
2609
								}
2610
							}
2611
						} elseif ( isset( $this->fields[ $k ] ) ) {
2612
							if ( 'table' === $this->pod_data['storage'] ) {
2613
								$key = "`t`.`{$k}`";
2614
							} else {
2615
								$key = "`{$k}`.`meta_value`";
2616
							}
2617
						}//end if
2618
2619
						if ( empty( $key ) ) {
2620
							$key = $k;
@@ 2657-2681 (lines=25) @@
2654
2655
					$key = $k;
2656
2657
					if ( ! in_array( $this->pod_data['type'], array( 'pod', 'table' ), true ) ) {
2658
						if ( isset( $this->pod_data['object_fields'][ $k ] ) ) {
2659
							$key = "`t`.`{$k}`";
2660
						} elseif ( isset( $this->fields[ $k ] ) ) {
2661
							if ( 'table' === $this->pod_data['storage'] ) {
2662
								$key = "`d`.`{$k}`";
2663
							} else {
2664
								$key = "`{$k}`.`meta_value`";
2665
							}
2666
						} else {
2667
							$object_fields = (array) $this->pod_data['object_fields'];
2668
2669
							foreach ( $object_fields as $object_field => $object_field_opt ) {
2670
								if ( $object_field === $k || in_array( $k, $object_field_opt['alias'], true ) ) {
2671
									$key = "`t`.`{$object_field}`";
2672
								}
2673
							}
2674
						}
2675
					} elseif ( isset( $this->fields[ $k ] ) ) {
2676
						if ( 'table' === $this->pod_data['storage'] ) {
2677
							$key = "`t`.`{$k}`";
2678
						} else {
2679
							$key = "`{$k}`.`meta_value`";
2680
						}
2681
					}//end if
2682
2683
					$prefix_orderby = "{$key} {$dir}";
2684