Code Duplication    Length = 20-20 lines in 2 locations

includes/shipping/legacy-local-pickup/class-wc-shipping-legacy-local-pickup.php 1 location

@@ 178-197 (lines=20) @@
175
	 * @param array $package
176
	 * @return bool
177
	 */
178
	public function is_available( $package ) {
179
		$is_available = "yes" === $this->enabled;
180
181
		if ( $is_available && $this->get_valid_postcodes() ) {
182
			$is_available = $this->is_valid_postcode( $package['destination']['postcode'], $package['destination']['country'] );
183
		}
184
185
		if ( $is_available ) {
186
			if ( $this->availability === 'specific' ) {
187
				$ship_to_countries = $this->countries;
188
			} else {
189
				$ship_to_countries = array_keys( WC()->countries->get_shipping_countries() );
190
			}
191
			if ( is_array( $ship_to_countries ) && ! in_array( $package['destination']['country'], $ship_to_countries ) ) {
192
				$is_available = false;
193
			}
194
		}
195
196
		return apply_filters( 'woocommerce_shipping_' . $this->id . '_is_available', $is_available, $package );
197
	}
198
199
	/**
200
	 * clean function.

includes/shipping/local-pickup/class-wc-shipping-local-pickup.php 1 location

@@ 143-162 (lines=20) @@
140
	 * @param array $package
141
	 * @return bool
142
	 */
143
	public function is_available( $package ) {
144
		$is_available = "yes" === $this->enabled;
145
146
		if ( $is_available && $this->get_valid_postcodes() ) {
147
			$is_available = $this->is_valid_postcode( $package['destination']['postcode'], $package['destination']['country'] );
148
		}
149
150
		if ( $is_available ) {
151
			if ( $this->availability === 'specific' ) {
152
				$ship_to_countries = $this->countries;
153
			} else {
154
				$ship_to_countries = array_keys( WC()->countries->get_shipping_countries() );
155
			}
156
			if ( is_array( $ship_to_countries ) && ! in_array( $package['destination']['country'], $ship_to_countries ) ) {
157
				$is_available = false;
158
			}
159
		}
160
161
		return apply_filters( 'woocommerce_shipping_' . $this->id . '_is_available', $is_available, $package );
162
	}
163
164
	/**
165
	 * clean function.