Volume.php 9.4 KB

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