Code Duplication    Length = 14-14 lines in 2 locations

includes/wc-formatting-functions.php 2 locations

@@ 86-99 (lines=14) @@
83
84
	// Unify all units to cm first.
85
	if ( $from_unit !== $to_unit ) {
86
		switch ( $from_unit ) {
87
			case 'in' :
88
				$dimension *= 2.54;
89
				break;
90
			case 'm' :
91
				$dimension *= 100;
92
				break;
93
			case 'mm' :
94
				$dimension *= 0.1;
95
				break;
96
			case 'yd' :
97
				$dimension *= 91.44;
98
				break;
99
		}
100
101
		// Output desired unit.
102
		switch ( $to_unit ) {
@@ 102-115 (lines=14) @@
99
		}
100
101
		// Output desired unit.
102
		switch ( $to_unit ) {
103
			case 'in' :
104
				$dimension *= 0.3937;
105
				break;
106
			case 'm' :
107
				$dimension *= 0.01;
108
				break;
109
			case 'mm' :
110
				$dimension *= 10;
111
				break;
112
			case 'yd' :
113
				$dimension *= 0.010936133;
114
				break;
115
		}
116
	}
117
118
	return ( $dimension < 0 ) ? 0 : $dimension;