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

@@ 609-619 (lines=11) @@
606
						throw new Exception( __( 'Unable to find shipping method for address.', 'woocommerce-gateway-stripe' ) );
607
					}
608
609
					foreach ( $package['rates'] as $key => $rate ) {
610
						$data[] = array(
611
							'id'       => $rate->id,
612
							'label'    => $rate->label,
613
							'amount'   => array(
614
								'currency' => $currency,
615
								'value'    => $rate->cost,
616
							),
617
							'selected' => false,
618
						);
619
					}
620
				}
621
622
				// Auto select the first shipping method.