Code Duplication    Length = 10-10 lines in 2 locations

includes/abstracts/abstract-wc-order.php 1 location

@@ 346-355 (lines=10) @@
343
	 * Add meta data.
344
	 * @param array $data Key/Value pairs
345
	 */
346
	public function add_meta_data( $key, $value, $unique = false ) {
347
		if ( $unique ) {
348
			$meta_ids = array_keys( wp_list_pluck( $this->_meta_data, 'key' ), $key );
349
			$this->_meta_data = array_diff_key( $this->_meta_data, array_fill_keys( $meta_ids, '' ) );
350
		}
351
		$this->_meta_data[ 'new-' . sizeof( $this->_meta_data ) ] = (object) array(
352
			'key'   => $key,
353
			'value' => $value,
354
		);
355
	}
356
357
	/**
358
	 * Update meta data by key or ID, if provided.

includes/class-wc-order-item.php 1 location

@@ 397-406 (lines=10) @@
394
	 * Add meta data.
395
	 * @param array $data Key/Value pairs
396
	 */
397
	public function add_meta_data( $key, $value, $unique = false ) {
398
		if ( $unique ) {
399
			$meta_ids = array_keys( wp_list_pluck( $this->_meta_data, 'key' ), $key );
400
			$this->_meta_data = array_diff_key( $this->_meta_data, array_fill_keys( $meta_ids, '' ) );
401
		}
402
		$this->_meta_data[ 'new-' . sizeof( $this->_meta_data ) ] = (object) array(
403
			'key'   => $key,
404
			'value' => $value
405
		);
406
	}
407
408
	/**
409
	 * Update meta data by key or ID, if provided.