Code Duplication    Length = 11-11 lines in 2 locations

includes/api/class-wc-rest-products-controller.php 1 location

@@ 973-983 (lines=11) @@
970
						wp_set_object_terms( $product->id, $values, $attribute_name );
971
					}
972
973
					if ( $values ) {
974
						// Add attribute to array, but don't set values.
975
						$attributes[ $attribute_name ] = array(
976
							'name'         => $attribute_name,
977
							'value'        => '',
978
							'position'     => isset( $attribute['position'] ) ? absint( $attribute['position'] ) : 0,
979
							'is_visible'   => ( isset( $attribute['visible'] ) && $attribute['visible'] ) ? 1 : 0,
980
							'is_variation' => ( isset( $attribute['variation'] ) && $attribute['variation'] ) ? 1 : 0,
981
							'is_taxonomy'  => true,
982
						);
983
					}
984
985
				} elseif ( isset( $attribute['options'] ) ) {
986
					// Array based.

includes/cli/class-wc-cli-product.php 1 location

@@ 1187-1197 (lines=11) @@
1184
						wp_set_object_terms( $product_id, $values, $taxonomy );
1185
					}
1186
1187
					if ( $values ) {
1188
						// Add attribute to array, but don't set values
1189
						$attributes[ $taxonomy ] = array(
1190
							'name'         => $taxonomy,
1191
							'value'        => '',
1192
							'position'     => isset( $attribute['position'] ) ? absint( $attribute['position'] ) : 0,
1193
							'is_visible'   => ( isset( $attribute['visible'] ) && $attribute['visible'] ) ? 1 : 0,
1194
							'is_variation' => ( isset( $attribute['variation'] ) && $attribute['variation'] ) ? 1 : 0,
1195
							'is_taxonomy'  => $is_taxonomy
1196
						);
1197
					}
1198
1199
				} elseif ( isset( $attribute['options'] ) ) {
1200
					// Array based