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
		foreach ( $jsonld['offers'] as &$offer ) {
37
			$this->shipping_zones->add_available_delivery_method( $offer );

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

@@ 151-154 (lines=4) @@
148
			$jsonld['shippingDetails'] = array();
149
		}
150
151
		if ( ! is_array( $jsonld['shippingDetails'] ) ||
152
		     ( ! empty( $jsonld['shippingDetails'] ) && ! is_numeric( key( $jsonld['shippingDetails'] ) ) ) ) {
153
			$jsonld['shippingDetails'] = array( $jsonld['shippingDetails'] );
154
		}
155
156
	}
157