Code Duplication    Length = 7-9 lines in 2 locations

includes/class-wc-cart.php 2 locations

@@ 834-840 (lines=7) @@
831
		 */
832
		public function find_product_in_cart( $cart_id = false ) {
833
			if ( $cart_id !== false ) {
834
				if ( is_array( $this->cart_contents ) ) {
835
					foreach ( $this->cart_contents as $cart_item_key => $cart_item ) {
836
						if ( $cart_item_key == $cart_id ) {
837
							return $cart_item_key;
838
						}
839
					}
840
				}
841
			}
842
			return '';
843
		}
@@ 852-860 (lines=9) @@
849
		 * @return bool
850
		 */
851
		public function is_product_in_cart( $product_id = false ) {
852
			if ( $product_id !== false ) {
853
				if ( is_array( $this->cart_contents ) ) {
854
					foreach ( $this->cart_contents as $cart_item_key => $cart_item ) {
855
						if ( $product_id === $cart_item['product_id'] ) {
856
							return true;
857
						}
858
					}
859
				}
860
			}
861
			return false;
862
		}
863