web/lib/Zend/Measure/Cooking/Weight.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     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: Weight.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 weight conversions
       
    30  *
       
    31  * @category   Zend
       
    32  * @package    Zend_Measure
       
    33  * @subpackage Zend_Measure_Cooking_Weight
       
    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_Weight extends Zend_Measure_Abstract
       
    38 {
       
    39     const STANDARD = 'GRAM';
       
    40 
       
    41     const HALF_STICK    = 'HALF_STICK';
       
    42     const STICK         = 'STICK';
       
    43     const CUP           = 'CUP';
       
    44     const GRAM          = 'GRAM';
       
    45     const OUNCE         = 'OUNCE';
       
    46     const POUND         = 'POUND';
       
    47     const TEASPOON      = 'TEASPOON';
       
    48     const TEASPOON_US   = 'TEASPOON_US';
       
    49     const TABLESPOON    = 'TABLESPOON';
       
    50     const TABLESPOON_US = 'TABLESPOON_US';
       
    51 
       
    52     /**
       
    53      * Calculations for all cooking weight units
       
    54      *
       
    55      * @var array
       
    56      */
       
    57     protected $_units = array(
       
    58         'HALF_STICK'    => array(array('' => '453.59237', '/' => '8'),                    'half stk'),
       
    59         'STICK'         => array(array('' => '453.59237', '/' => '4'),                    'stk'),
       
    60         'CUP'           => array(array('' => '453.59237', '/' => '2'),                    'c'),
       
    61         'GRAM'          => array('1',                                                   'g'),
       
    62         'OUNCE'         => array(array('' => '453.59237', '/' => '16'),                   'oz'),
       
    63         'POUND'         => array('453.59237',                                           'lb'),
       
    64         'TEASPOON'      => array(array('' => '1.2503332', '' => '453.59237', '/' => '128'), 'tsp'),
       
    65         'TEASPOON_US'   => array(array('' => '453.59237', '/' => '96'),                   'tsp'),
       
    66         'TABLESPOON'    => array(array('' => '1.2503332', '' => '453.59237', '/' => '32'),  'tbsp'),
       
    67         'TABLESPOON_US' => array(array('' => '453.59237', '/' => '32'),                   'tbsp'),
       
    68         'STANDARD'      => 'GRAM'
       
    69     );
       
    70 }