Code Duplication    Length = 14-14 lines in 2 locations

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

@@ 68-81 (lines=14) @@
65
	 * @param string $offset
66
	 * @param mixed $value
67
	 */
68
	public function offsetSet( $offset, $value ) {
69
		if ( 'item_meta_array' === $offset ) {
70
			foreach ( $value as $meta_id => $meta ) {
71
				$this->update_meta_data( $meta->key, $meta->value, $meta_id );
72
			}
73
			return;
74
		}
75
76
		if ( array_key_exists( $offset, $this->data ) ) {
77
			$this->data[ $offset ] = $value;
78
		}
79
80
		$this->update_meta_data( '_' . $offset, $value );
81
	}
82
83
	/**
84
	 * offsetUnset for ArrayAccess

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

@@ 320-333 (lines=14) @@
317
	 * @param string $offset
318
	 * @param mixed $value
319
	 */
320
	public function offsetSet( $offset, $value ) {
321
		if ( 'item_meta_array' === $offset ) {
322
			foreach ( $value as $meta_id => $meta ) {
323
				$this->update_meta_data( $meta->key, $meta->value, $meta_id );
324
			}
325
			return;
326
		}
327
328
		if ( array_key_exists( $offset, $this->data ) ) {
329
			$this->data[ $offset ] = $value;
330
		}
331
332
		$this->update_meta_data( '_' . $offset, $value );
333
	}
334
335
	/**
336
	 * offsetUnset for ArrayAccess