Weight.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 weight conversions
  28. *
  29. * @category Zend
  30. * @package Zend_Measure
  31. * @subpackage Zend_Measure_Cooking_Weight
  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_Weight extends Zend_Measure_Abstract
  36. {
  37. const STANDARD = 'GRAM';
  38. const HALF_STICK = 'HALF_STICK';
  39. const STICK = 'STICK';
  40. const CUP = 'CUP';
  41. const GRAM = 'GRAM';
  42. const OUNCE = 'OUNCE';
  43. const POUND = 'POUND';
  44. const TEASPOON = 'TEASPOON';
  45. const TEASPOON_US = 'TEASPOON_US';
  46. const TABLESPOON = 'TABLESPOON';
  47. const TABLESPOON_US = 'TABLESPOON_US';
  48. /**
  49. * Calculations for all cooking weight units
  50. *
  51. * @var array
  52. */
  53. protected $_units = array(
  54. 'HALF_STICK' => array(array('' => '453.59237', '/' => '8'), 'half stk'),
  55. 'STICK' => array(array('' => '453.59237', '/' => '4'), 'stk'),
  56. 'CUP' => array(array('' => '453.59237', '/' => '2'), 'c'),
  57. 'GRAM' => array('1', 'g'),
  58. 'OUNCE' => array(array('' => '453.59237', '/' => '16'), 'oz'),
  59. 'POUND' => array('453.59237', 'lb'),
  60. 'TEASPOON' => array(array('' => '1.2503332', '' => '453.59237', '/' => '128'), 'tsp'),
  61. 'TEASPOON_US' => array(array('' => '453.59237', '/' => '96'), 'tsp'),
  62. 'TABLESPOON' => array(array('' => '1.2503332', '' => '453.59237', '/' => '32'), 'tbsp'),
  63. 'TABLESPOON_US' => array(array('' => '453.59237', '/' => '32'), 'tbsp'),
  64. 'STANDARD' => 'GRAM'
  65. );
  66. }