Code Duplication    Length = 25-25 lines in 2 locations

classes/Pods.php 2 locations

@@ 2565-2589 (lines=25) @@
2562
					}
2563
2564
					if ( empty( $key ) ) {
2565
						if ( ! in_array( $this->pod_data['type'], array( 'pod', 'table' ), true ) ) {
2566
							if ( isset( $this->pod_data['object_fields'][ $k ] ) ) {
2567
								$key = "`t`.`{$k}`";
2568
							} elseif ( isset( $this->fields[ $k ] ) ) {
2569
								if ( 'table' === $this->pod_data['storage'] ) {
2570
									$key = "`d`.`{$k}`";
2571
								} else {
2572
									$key = "`{$k}`.`meta_value`";
2573
								}
2574
							} else {
2575
								$object_fields = (array) $this->pod_data['object_fields'];
2576
2577
								foreach ( $object_fields as $object_field => $object_field_opt ) {
2578
									if ( $object_field === $k || in_array( $k, $object_field_opt['alias'], true ) ) {
2579
										$key = "`t`.`{$object_field}`";
2580
									}
2581
								}
2582
							}
2583
						} elseif ( isset( $this->fields[ $k ] ) ) {
2584
							if ( 'table' === $this->pod_data['storage'] ) {
2585
								$key = "`t`.`{$k}`";
2586
							} else {
2587
								$key = "`{$k}`.`meta_value`";
2588
							}
2589
						}
2590
2591
						if ( empty( $key ) ) {
2592
							$key = $k;
@@ 2627-2651 (lines=25) @@
2624
2625
					$key = $k;
2626
2627
					if ( ! in_array( $this->pod_data['type'], array( 'pod', 'table' ), true ) ) {
2628
						if ( isset( $this->pod_data['object_fields'][ $k ] ) ) {
2629
							$key = "`t`.`{$k}`";
2630
						} elseif ( isset( $this->fields[ $k ] ) ) {
2631
							if ( 'table' === $this->pod_data['storage'] ) {
2632
								$key = "`d`.`{$k}`";
2633
							} else {
2634
								$key = "`{$k}`.`meta_value`";
2635
							}
2636
						} else {
2637
							$object_fields = (array) $this->pod_data['object_fields'];
2638
2639
							foreach ( $object_fields as $object_field => $object_field_opt ) {
2640
								if ( $object_field === $k || in_array( $k, $object_field_opt['alias'], true ) ) {
2641
									$key = "`t`.`{$object_field}`";
2642
								}
2643
							}
2644
						}
2645
					} elseif ( isset( $this->fields[ $k ] ) ) {
2646
						if ( 'table' === $this->pod_data['storage'] ) {
2647
							$key = "`t`.`{$k}`";
2648
						} else {
2649
							$key = "`{$k}`.`meta_value`";
2650
						}
2651
					}
2652
2653
					$prefix_orderby = "{$key} {$dir}";
2654
				}