Code Duplication    Length = 14-14 lines in 2 locations

includes/wc-formatting-functions.php 2 locations

@@ 63-76 (lines=14) @@
60
61
	// Unify all units to cm first.
62
	if ( $from_unit !== $to_unit ) {
63
		switch ( $from_unit ) {
64
			case 'in' :
65
				$dimension *= 2.54;
66
				break;
67
			case 'm' :
68
				$dimension *= 100;
69
				break;
70
			case 'mm' :
71
				$dimension *= 0.1;
72
				break;
73
			case 'yd' :
74
				$dimension *= 91.44;
75
				break;
76
		}
77
78
		// Output desired unit.
79
		switch ( $to_unit ) {
@@ 79-92 (lines=14) @@
76
		}
77
78
		// Output desired unit.
79
		switch ( $to_unit ) {
80
			case 'in' :
81
				$dimension *= 0.3937;
82
				break;
83
			case 'm' :
84
				$dimension *= 0.01;
85
				break;
86
			case 'mm' :
87
				$dimension *= 10;
88
				break;
89
			case 'yd' :
90
				$dimension *= 0.010936133;
91
				break;
92
		}
93
	}
94
95
	return ( $dimension < 0 ) ? 0 : $dimension;