|
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: Temperature.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 temperature conversions |
|
30 * |
|
31 * @category Zend |
|
32 * @package Zend_Measure |
|
33 * @subpackage Zend_Measure_Temperature |
|
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_Temperature extends Zend_Measure_Abstract |
|
38 { |
|
39 const STANDARD = 'KELVIN'; |
|
40 |
|
41 const CELSIUS = 'CELSIUS'; |
|
42 const FAHRENHEIT = 'FAHRENHEIT'; |
|
43 const RANKINE = 'RANKINE'; |
|
44 const REAUMUR = 'REAUMUR'; |
|
45 const KELVIN = 'KELVIN'; |
|
46 |
|
47 /** |
|
48 * Calculations for all temperature units |
|
49 * |
|
50 * @var array |
|
51 */ |
|
52 protected $_units = array( |
|
53 'CELSIUS' => array(array('' => '1', '+' => '273.15'),'°C'), |
|
54 'FAHRENHEIT' => array(array('' => '1', '-' => '32', '/' => '1.8', '+' => '273.15'),'°F'), |
|
55 'RANKINE' => array(array('' => '1', '/' => '1.8'),'°R'), |
|
56 'REAUMUR' => array(array('' => '1', '*' => '1.25', '+' => '273.15'),'°r'), |
|
57 'KELVIN' => array(1,'°K'), |
|
58 'STANDARD' => 'KELVIN' |
|
59 ); |
|
60 } |