Code Duplication    Length = 11-11 lines in 2 locations

includes/class-wc-stripe-payment-request.php 1 location

@@ 227-237 (lines=11) @@
224
					break;
225
				}
226
227
				foreach ( $package['rates'] as $key => $rate ) {
228
					$data[] = array(
229
						'id'       => $rate->id,
230
						'label'    => $rate->label,
231
						'amount'   => array(
232
							'currency' => $currency,
233
							'value'    => $rate->cost,
234
						),
235
						'selected' => false,
236
					);
237
				}
238
			}
239
		}
240

includes/class-wc-stripe-apple-pay.php 1 location

@@ 583-593 (lines=11) @@
580
						throw new Exception( __( 'Unable to find shipping method for address.', 'woocommerce-gateway-stripe' ) );
581
					}
582
583
					foreach ( $package['rates'] as $key => $rate ) {
584
						$data[] = array(
585
							'id'       => $rate->id,
586
							'label'    => $rate->label,
587
							'amount'   => array(
588
								'currency' => $currency,
589
								'value'    => $rate->cost,
590
							),
591
							'selected' => false,
592
						);
593
					}
594
				}
595
596
				// Auto select the first shipping method.