|
1 <?php |
|
2 /** |
|
3 * Zend Framework |
|
4 * |
|
5 * LICENSE |
|
6 * |
|
7 * This source file is subject to the new BSD license that is bundled |
|
8 * with this package in the file LICENSE.txt. |
|
9 * It is also available through the world-wide-web at this URL: |
|
10 * http://framework.zend.com/license/new-bsd |
|
11 * If you did not receive a copy of the license and are unable to |
|
12 * obtain it through the world-wide-web, please send an email |
|
13 * to license@zend.com so we can send you a copy immediately. |
|
14 * |
|
15 * @category Zend |
|
16 * @package Zend_Measure |
|
17 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
18 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
19 * @version $Id: Volume.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
20 */ |
|
21 |
|
22 /** |
|
23 * Implement needed classes |
|
24 */ |
|
25 require_once 'Zend/Measure/Abstract.php'; |
|
26 require_once 'Zend/Locale.php'; |
|
27 |
|
28 /** |
|
29 * Class for handling cooking volume conversions |
|
30 * |
|
31 * @category Zend |
|
32 * @package Zend_Measure |
|
33 * @subpackage Zend_Measure_Cooking_Volume |
|
34 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
35 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
36 */ |
|
37 class Zend_Measure_Cooking_Volume extends Zend_Measure_Abstract |
|
38 { |
|
39 const STANDARD = 'CUBIC_METER'; |
|
40 |
|
41 const CAN_2POINT5 = 'CAN_2POINT5'; |
|
42 const CAN_10 = 'CAN_10'; |
|
43 const BARREL_WINE = 'BARREL_WINE'; |
|
44 const BARREL = 'BARREL'; |
|
45 const BARREL_US_DRY = 'BARREL_US_DRY'; |
|
46 const BARREL_US_FEDERAL = 'BARREL_US_FEDERAL'; |
|
47 const BARREL_US = 'BARREL_US'; |
|
48 const BUCKET = 'BUCKET'; |
|
49 const BUCKET_US = 'BUCKET_US'; |
|
50 const BUSHEL = 'BUSHEL'; |
|
51 const BUSHEL_US = 'BUSHEL_US'; |
|
52 const CENTILITER = 'CENTILITER'; |
|
53 const COFFEE_SPOON = 'COFFEE_SPOON'; |
|
54 const CUBIC_CENTIMETER = 'CUBIC_CENTIMETER'; |
|
55 const CUBIC_DECIMETER = 'CUBIC_DECIMETER'; |
|
56 const CUBIC_FOOT = 'CUBIC_FOOT'; |
|
57 const CUBIC_INCH = 'CUBIC_INCH'; |
|
58 const CUBIC_METER = 'CUBIC_METER'; |
|
59 const CUBIC_MICROMETER = 'CUBIC_MICROMETER'; |
|
60 const CUBIC_MILLIMETER = 'CUBIC_MILLIMETER'; |
|
61 const CUP_CANADA = 'CUP_CANADA'; |
|
62 const CUP = 'CUP'; |
|
63 const CUP_US = 'CUP_US'; |
|
64 const DASH = 'DASH'; |
|
65 const DECILITER = 'DECILITER'; |
|
66 const DEKALITER = 'DEKALITER'; |
|
67 const DEMI = 'DEMI'; |
|
68 const DRAM = 'DRAM'; |
|
69 const DROP = 'DROP'; |
|
70 const FIFTH = 'FIFTH'; |
|
71 const GALLON = 'GALLON'; |
|
72 const GALLON_US_DRY = 'GALLON_US_DRY'; |
|
73 const GALLON_US = 'GALLON_US'; |
|
74 const GILL = 'GILL'; |
|
75 const GILL_US = 'GILL_US'; |
|
76 const HECTOLITER = 'HECTOLITER'; |
|
77 const HOGSHEAD = 'HOGSHEAD'; |
|
78 const HOGSHEAD_US = 'HOGSHEAD_US'; |
|
79 const JIGGER = 'JIGGER'; |
|
80 const KILOLITER = 'KILOLITER'; |
|
81 const LITER = 'LITER'; |
|
82 const MEASURE = 'MEASURE'; |
|
83 const MEGALITER = 'MEGALITER'; |
|
84 const MICROLITER = 'MICROLITER'; |
|
85 const MILLILITER = 'MILLILITER'; |
|
86 const MINIM = 'MINIM'; |
|
87 const MINIM_US = 'MINIM_US'; |
|
88 const OUNCE = 'OUNCE'; |
|
89 const OUNCE_US = 'OUNCE_US'; |
|
90 const PECK = 'PECK'; |
|
91 const PECK_US = 'PECK_US'; |
|
92 const PINCH = 'PINCH'; |
|
93 const PINT = 'PINT'; |
|
94 const PINT_US_DRY = 'PINT_US_DRY'; |
|
95 const PINT_US = 'PINT_US'; |
|
96 const PIPE = 'PIPE'; |
|
97 const PIPE_US = 'PIPE_US'; |
|
98 const PONY = 'PONY'; |
|
99 const QUART_GERMANY = 'QUART_GERMANY'; |
|
100 const QUART_ANCIENT = 'QUART_ANCIENT'; |
|
101 const QUART = 'QUART'; |
|
102 const QUART_US_DRY = 'QUART_US_DRY'; |
|
103 const QUART_US = 'QUART_US'; |
|
104 const SHOT = 'SHOT'; |
|
105 const TABLESPOON = 'TABLESPOON'; |
|
106 const TABLESPOON_UK = 'TABLESPOON_UK'; |
|
107 const TABLESPOON_US = 'TABLESPOON_US'; |
|
108 const TEASPOON = 'TEASPOON'; |
|
109 const TEASPOON_UK = 'TEASPOON_UK'; |
|
110 const TEASPOON_US = 'TEASPOON_US'; |
|
111 |
|
112 /** |
|
113 * Calculations for all cooking volume units |
|
114 * |
|
115 * @var array |
|
116 */ |
|
117 protected $_units = array( |
|
118 'CAN_2POINT5' => array(array('' => '0.0037854118', '/' => '16', '' => '3.5'), '2.5th can'), |
|
119 'CAN_10' => array(array('' => '0.0037854118', '*' => '0.75'), '10th can'), |
|
120 'BARREL_WINE' => array('0.143201835', 'bbl'), |
|
121 'BARREL' => array('0.16365924', 'bbl'), |
|
122 'BARREL_US_DRY' => array(array('' => '26.7098656608', '/' => '231'), 'bbl'), |
|
123 'BARREL_US_FEDERAL' => array('0.1173477658', 'bbl'), |
|
124 'BARREL_US' => array('0.1192404717', 'bbl'), |
|
125 'BUCKET' => array('0.01818436', 'bucket'), |
|
126 'BUCKET_US' => array('0.018927059', 'bucket'), |
|
127 'BUSHEL' => array('0.03636872', 'bu'), |
|
128 'BUSHEL_US' => array('0.03523907', 'bu'), |
|
129 'CENTILITER' => array('0.00001', 'cl'), |
|
130 'COFFEE_SPOON' => array(array('' => '0.0037854118', '/' => '1536'), 'coffee spoon'), |
|
131 'CUBIC_CENTIMETER' => array('0.000001', 'cm³'), |
|
132 'CUBIC_DECIMETER' => array('0.001', 'dm³'), |
|
133 'CUBIC_FOOT' => array(array('' => '6.54119159', '/' => '231'), 'ft³'), |
|
134 'CUBIC_INCH' => array(array('' => '0.0037854118', '/' => '231'), 'in³'), |
|
135 'CUBIC_METER' => array('1', 'm³'), |
|
136 'CUBIC_MICROMETER' => array('1.0e-18', 'µm³'), |
|
137 'CUBIC_MILLIMETER' => array('1.0e-9', 'mm³'), |
|
138 'CUP_CANADA' => array('0.0002273045', 'c'), |
|
139 'CUP' => array('0.00025', 'c'), |
|
140 'CUP_US' => array(array('' => '0.0037854118', '/' => '16'), 'c'), |
|
141 'DASH' => array(array('' => '0.0037854118', '/' => '6144'), 'ds'), |
|
142 'DECILITER' => array('0.0001', 'dl'), |
|
143 'DEKALITER' => array('0.001', 'dal'), |
|
144 'DEMI' => array('0.00025', 'demi'), |
|
145 'DRAM' => array(array('' => '0.0037854118', '/' => '1024'), 'dr'), |
|
146 'DROP' => array(array('' => '0.0037854118', '/' => '73728'), 'ggt'), |
|
147 'FIFTH' => array('0.00075708236', 'fifth'), |
|
148 'GALLON' => array('0.00454609', 'gal'), |
|
149 'GALLON_US_DRY' => array('0.0044048838', 'gal'), |
|
150 'GALLON_US' => array('0.0037854118', 'gal'), |
|
151 'GILL' => array(array('' => '0.00454609', '/' => '32'), 'gi'), |
|
152 'GILL_US' => array(array('' => '0.0037854118', '/' => '32'), 'gi'), |
|
153 'HECTOLITER' => array('0.1', 'hl'), |
|
154 'HOGSHEAD' => array('0.28640367', 'hhd'), |
|
155 'HOGSHEAD_US' => array('0.2384809434', 'hhd'), |
|
156 'JIGGER' => array(array('' => '0.0037854118', '/' => '128', '*' => '1.5'), 'jigger'), |
|
157 'KILOLITER' => array('1', 'kl'), |
|
158 'LITER' => array('0.001', 'l'), |
|
159 'MEASURE' => array('0.0077', 'measure'), |
|
160 'MEGALITER' => array('1000', 'Ml'), |
|
161 'MICROLITER' => array('1.0e-9', 'µl'), |
|
162 'MILLILITER' => array('0.000001', 'ml'), |
|
163 'MINIM' => array(array('' => '0.00454609', '/' => '76800'), 'min'), |
|
164 'MINIM_US' => array(array('' => '0.0037854118','/' => '61440'), 'min'), |
|
165 'OUNCE' => array(array('' => '0.00454609', '/' => '160'), 'oz'), |
|
166 'OUNCE_US' => array(array('' => '0.0037854118', '/' => '128'), 'oz'), |
|
167 'PECK' => array('0.00909218', 'pk'), |
|
168 'PECK_US' => array('0.0088097676', 'pk'), |
|
169 'PINCH' => array(array('' => '0.0037854118', '/' => '12288'), 'pinch'), |
|
170 'PINT' => array(array('' => '0.00454609', '/' => '8'), 'pt'), |
|
171 'PINT_US_DRY' => array(array('' => '0.0044048838', '/' => '8'), 'pt'), |
|
172 'PINT_US' => array(array('' => '0.0037854118', '/' => '8'), 'pt'), |
|
173 'PIPE' => array('0.49097772', 'pipe'), |
|
174 'PIPE_US' => array('0.4769618868', 'pipe'), |
|
175 'PONY' => array(array('' => '0.0037854118', '/' => '128'), 'pony'), |
|
176 'QUART_GERMANY' => array('0.00114504', 'qt'), |
|
177 'QUART_ANCIENT' => array('0.00108', 'qt'), |
|
178 'QUART' => array(array('' => '0.00454609', '/' => '4'), 'qt'), |
|
179 'QUART_US_DRY' => array(array('' => '0.0044048838', '/' => '4'), 'qt'), |
|
180 'QUART_US' => array(array('' => '0.0037854118', '/' => '4'), 'qt'), |
|
181 'SHOT' => array(array('' => '0.0037854118', '/' => '128'), 'shot'), |
|
182 'TABLESPOON' => array('0.000015', 'tbsp'), |
|
183 'TABLESPOON_UK' => array(array('' => '0.00454609', '/' => '320'), 'tbsp'), |
|
184 'TABLESPOON_US' => array(array('' => '0.0037854118', '/' => '256'), 'tbsp'), |
|
185 'TEASPOON' => array('0.000005', 'tsp'), |
|
186 'TEASPOON_UK' => array(array('' => '0.00454609', '/' => '1280'), 'tsp'), |
|
187 'TEASPOON_US' => array(array('' => '0.0037854118', '/' => '768'), 'tsp'), |
|
188 'STANDARD' => 'CUBIC_METER' |
|
189 ); |
|
190 } |