Code Duplication    Length = 3-4 lines in 2 locations

src/wordlift/shipping-data/class-offer-structured-data.php 1 location

@@ 32-34 (lines=3) @@
29
			return $jsonld;
30
		}
31
32
		if ( ! is_array( $jsonld['offers'] ) || ! is_numeric( key( $jsonld['offers'] ) ) ) {
33
			$jsonld['offers'] = array( $jsonld['offers'] );
34
		}
35
36
		$product = new Product( $post_id );
37

src/wordlift/shipping-data/class-shipping-zone.php 1 location

@@ 212-215 (lines=4) @@
209
			$jsonld['shippingDetails'] = array();
210
		}
211
212
		if ( ! is_array( $jsonld['shippingDetails'] ) ||
213
		     ( ! empty( $jsonld['shippingDetails'] ) && ! is_numeric( key( $jsonld['shippingDetails'] ) ) ) ) {
214
			$jsonld['shippingDetails'] = array( $jsonld['shippingDetails'] );
215
		}
216
217
	}
218