Code Duplication    Length = 17-17 lines in 2 locations

includes/shipping/flat-rate/class-wc-shipping-flat-rate.php 1 location

@@ 220-236 (lines=17) @@
217
	 * @param mixed $package
218
	 * @return array
219
	 */
220
	public function find_shipping_classes( $package ) {
221
		$found_shipping_classes = array();
222
223
		foreach ( $package['contents'] as $item_id => $values ) {
224
			if ( $values['data']->needs_shipping() ) {
225
				$found_class = $values['data']->get_shipping_class();
226
227
				if ( ! isset( $found_shipping_classes[ $found_class ] ) ) {
228
					$found_shipping_classes[ $found_class ] = array();
229
				}
230
231
				$found_shipping_classes[ $found_class ][ $item_id ] = $values;
232
			}
233
		}
234
235
		return $found_shipping_classes;
236
	}
237
}
238

includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php 1 location

@@ 238-254 (lines=17) @@
235
	 * @param mixed $package
236
	 * @return array
237
	 */
238
	public function find_shipping_classes( $package ) {
239
		$found_shipping_classes = array();
240
241
		foreach ( $package['contents'] as $item_id => $values ) {
242
			if ( $values['data']->needs_shipping() ) {
243
				$found_class = $values['data']->get_shipping_class();
244
245
				if ( ! isset( $found_shipping_classes[ $found_class ] ) ) {
246
					$found_shipping_classes[ $found_class ] = array();
247
				}
248
249
				$found_shipping_classes[ $found_class ][ $item_id ] = $values;
250
			}
251
		}
252
253
		return $found_shipping_classes;
254
	}
255
256
	/**
257
	 * Adds extra calculated flat rates.