Code Duplication    Length = 14-14 lines in 2 locations

includes/wc-formatting-functions.php 2 locations

@@ 107-120 (lines=14) @@
104
105
	// Unify all units to cm first.
106
	if ( $from_unit !== $to_unit ) {
107
		switch ( $from_unit ) {
108
			case 'in' :
109
				$dimension *= 2.54;
110
				break;
111
			case 'm' :
112
				$dimension *= 100;
113
				break;
114
			case 'mm' :
115
				$dimension *= 0.1;
116
				break;
117
			case 'yd' :
118
				$dimension *= 91.44;
119
				break;
120
		}
121
122
		// Output desired unit.
123
		switch ( $to_unit ) {
@@ 123-136 (lines=14) @@
120
		}
121
122
		// Output desired unit.
123
		switch ( $to_unit ) {
124
			case 'in' :
125
				$dimension *= 0.3937;
126
				break;
127
			case 'm' :
128
				$dimension *= 0.01;
129
				break;
130
			case 'mm' :
131
				$dimension *= 10;
132
				break;
133
			case 'yd' :
134
				$dimension *= 0.010936133;
135
				break;
136
		}
137
	}
138
139
	return ( $dimension < 0 ) ? 0 : $dimension;