File indexing completed on 2024-12-22 05:36:52

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category  Zend
0016  * @package   Zend_Measure
0017  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0018  * @license   http://framework.zend.com/license/new-bsd     New BSD License
0019  * @version   $Id$
0020  */
0021 
0022 /**
0023  * Implement needed classes
0024  */
0025 // require_once 'Zend/Measure/Abstract.php';
0026 // require_once 'Zend/Locale.php';
0027 
0028 /**
0029  * Class for handling speed conversions
0030  *
0031  * @category   Zend
0032  * @package    Zend_Measure
0033  * @subpackage Zend_Measure_Speed
0034  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0035  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0036  */
0037 class Zend_Measure_Speed extends Zend_Measure_Abstract
0038 {
0039     const STANDARD = 'METER_PER_SECOND';
0040 
0041     const BENZ                           = 'BENZ';
0042     const CENTIMETER_PER_DAY             = 'CENTIMETER_PER_DAY';
0043     const CENTIMETER_PER_HOUR            = 'CENTIMETER_PER_HOUR';
0044     const CENTIMETER_PER_MINUTE          = 'CENTIMETER_PER_MINUTE';
0045     const CENTIMETER_PER_SECOND          = 'CENTIMETER_PER_SECOND';
0046     const DEKAMETER_PER_DAY              = 'DEKAMETER_PER_DAY';
0047     const DEKAMETER_PER_HOUR             = 'DEKAMETER_PER_HOUR';
0048     const DEKAMETER_PER_MINUTE           = 'DEKAMETER_PER_MINUTE';
0049     const DEKAMETER_PER_SECOND           = 'DEKAMETER_PER_SECOND';
0050     const FOOT_PER_DAY                   = 'FOOT_PER_DAY';
0051     const FOOT_PER_HOUR                  = 'FOOT_PER_HOUR';
0052     const FOOT_PER_MINUTE                = 'FOOT_PER_MINUTE';
0053     const FOOT_PER_SECOND                = 'FOOT_PER_SECOND';
0054     const FURLONG_PER_DAY                = 'FURLONG_PER_DAY';
0055     const FURLONG_PER_FORTNIGHT          = 'FURLONG_PER_FORTNIGHT';
0056     const FURLONG_PER_HOUR               = 'FURLONG_PER_HOUR';
0057     const FURLONG_PER_MINUTE             = 'FURLONG_PER_MINUTE';
0058     const FURLONG_PER_SECOND             = 'FURLONG_PER_SECOND';
0059     const HECTOMETER_PER_DAY             = 'HECTOMETER_PER_DAY';
0060     const HECTOMETER_PER_HOUR            = 'HECTOMETER_PER_HOUR';
0061     const HECTOMETER_PER_MINUTE          = 'HECTOMETER_PER_MINUTE';
0062     const HECTOMETER_PER_SECOND          = 'HECTOMETER_PER_SECOND';
0063     const INCH_PER_DAY                   = 'INCH_PER_DAY';
0064     const INCH_PER_HOUR                  = 'INCH_PER_HOUR';
0065     const INCH_PER_MINUTE                = 'INCH_PER_MINUTE';
0066     const INCH_PER_SECOND                = 'INCH_PER_SECOND';
0067     const KILOMETER_PER_DAY              = 'KILOMETER_PER_DAY';
0068     const KILOMETER_PER_HOUR             = 'KILOMETER_PER_HOUR';
0069     const KILOMETER_PER_MINUTE           = 'KILOMETER_PER_MINUTE';
0070     const KILOMETER_PER_SECOND           = 'KILOMETER_PER_SECOND';
0071     const KNOT                           = 'KNOT';
0072     const LEAGUE_PER_DAY                 = 'LEAGUE_PER_DAY';
0073     const LEAGUE_PER_HOUR                = 'LEAGUE_PER_HOUR';
0074     const LEAGUE_PER_MINUTE              = 'LEAGUE_PER_MINUTE';
0075     const LEAGUE_PER_SECOND              = 'LEAGUE_PER_SECOND';
0076     const MACH                           = 'MACH';
0077     const MEGAMETER_PER_DAY              = 'MEGAMETER_PER_DAY';
0078     const MEGAMETER_PER_HOUR             = 'MEGAMETER_PER_HOUR';
0079     const MEGAMETER_PER_MINUTE           = 'MEGAMETER_PER_MINUTE';
0080     const MEGAMETER_PER_SECOND           = 'MEGAMETER_PER_SECOND';
0081     const METER_PER_DAY                  = 'METER_PER_DAY';
0082     const METER_PER_HOUR                 = 'METER_PER_HOUR';
0083     const METER_PER_MINUTE               = 'METER_PER_MINUTE';
0084     const METER_PER_SECOND               = 'METER_PER_SECOND';
0085     const MILE_PER_DAY                   = 'MILE_PER_DAY';
0086     const MILE_PER_HOUR                  = 'MILE_PER_HOUR';
0087     const MILE_PER_MINUTE                = 'MILE_PER_MINUTE';
0088     const MILE_PER_SECOND                = 'MILE_PER_SECOND';
0089     const MILLIMETER_PER_DAY             = 'MILLIMETER_PER_DAY';
0090     const MILLIMETER_PER_HOUR            = 'MILLIMETER_PER_HOUR';
0091     const MILLIMETER_PER_MINUTE          = 'MILLIMETER_PER_MINUTE';
0092     const MILLIMETER_PER_SECOND          = 'MILLIMETER_PER_SECOND';
0093     const MILLIMETER_PER_MICROSECOND     = 'MILLIMETER_PER_MICROSECOND';
0094     const MILLIMETER_PER_100_MICROSECOND = 'MILLIMETER_PER_100_MICROSECOND';
0095     const NAUTIC_MILE_PER_DAY            = 'NAUTIC_MILE_PER_DAY';
0096     const NAUTIC_MILE_PER_HOUR           = 'NAUTIC_MILE_PER_HOUR';
0097     const NAUTIC_MILE_PER_MINUTE         = 'NAUTIC_MILE_PER_MINUTE';
0098     const NAUTIC_MILE_PER_SECOND         = 'NAUTIC_MILE_PER_SECOND';
0099     const LIGHTSPEED_AIR                 = 'LIGHTSPEED_AIR';
0100     const LIGHTSPEED_GLASS               = 'LIGHTSPEED_GLASS';
0101     const LIGHTSPEED_ICE                 = 'LIGHTSPEED_ICE';
0102     const LIGHTSPEED_VACUUM              = 'LIGHTSPEED_VACUUM';
0103     const LIGHTSPEED_WATER               = 'LIGHTSPEED_WATER';
0104     const SOUNDSPEED_AIR                 = 'SOUNDSPEED_AIT';
0105     const SOUNDSPEED_METAL               = 'SOUNDSPEED_METAL';
0106     const SOUNDSPEED_WATER               = 'SOUNDSPEED_WATER';
0107     const YARD_PER_DAY                   = 'YARD_PER_DAY';
0108     const YARD_PER_HOUR                  = 'YARD_PER_HOUR';
0109     const YARD_PER_MINUTE                = 'YARD_PER_MINUTE';
0110     const YARD_PER_SECOND                = 'YARD_PER_SECOND';
0111 
0112     /**
0113      * Calculations for all speed units
0114      *
0115      * @var array
0116      */
0117     protected $_units = array(
0118         'BENZ'                           => array('1',                                     'Bz'),
0119         'CENTIMETER_PER_DAY'             => array(array('' => '0.01', '/' => '86400'),       'cm/day'),
0120         'CENTIMETER_PER_HOUR'            => array(array('' => '0.01', '/' => '3600'),        'cm/h'),
0121         'CENTIMETER_PER_MINUTE'          => array(array('' => '0.01', '/' => '60'),          'cm/m'),
0122         'CENTIMETER_PER_SECOND'          => array('0.01',                                  'cd/s'),
0123         'DEKAMETER_PER_DAY'              => array(array('' => '10', '/' => '86400'),         'dam/day'),
0124         'DEKAMETER_PER_HOUR'             => array(array('' => '10', '/' => '3600'),          'dam/h'),
0125         'DEKAMETER_PER_MINUTE'           => array(array('' => '10', '/' => '60'),            'dam/m'),
0126         'DEKAMETER_PER_SECOND'           => array('10',                                    'dam/s'),
0127         'FOOT_PER_DAY'                   => array(array('' => '0.3048', '/' => '86400'),     'ft/day'),
0128         'FOOT_PER_HOUR'                  => array(array('' => '0.3048', '/' => '3600'),      'ft/h'),
0129         'FOOT_PER_MINUTE'                => array(array('' => '0.3048', '/' => '60'),        'ft/m'),
0130         'FOOT_PER_SECOND'                => array('0.3048',                                'ft/s'),
0131         'FURLONG_PER_DAY'                => array(array('' => '201.1684', '/' => '86400'),   'fur/day'),
0132         'FURLONG_PER_FORTNIGHT'          => array(array('' => '201.1684', '/' => '1209600'), 'fur/fortnight'),
0133         'FURLONG_PER_HOUR'               => array(array('' => '201.1684', '/' => '3600'),    'fur/h'),
0134         'FURLONG_PER_MINUTE'             => array(array('' => '201.1684', '/' => '60'),      'fur/m'),
0135         'FURLONG_PER_SECOND'             => array('201.1684',                              'fur/s'),
0136         'HECTOMETER_PER_DAY'             => array(array('' => '100', '/' => '86400'),        'hm/day'),
0137         'HECTOMETER_PER_HOUR'            => array(array('' => '100', '/' => '3600'),         'hm/h'),
0138         'HECTOMETER_PER_MINUTE'          => array(array('' => '100', '/' => '60'),           'hm/m'),
0139         'HECTOMETER_PER_SECOND'          => array('100',                                   'hm/s'),
0140         'INCH_PER_DAY'                   => array(array('' => '0.0254', '/' => '86400'),     'in/day'),
0141         'INCH_PER_HOUR'                  => array(array('' => '0.0254', '/' => '3600'),      'in/h'),
0142         'INCH_PER_MINUTE'                => array(array('' => '0.0254', '/' => '60'),        'in/m'),
0143         'INCH_PER_SECOND'                => array('0.0254',                                'in/s'),
0144         'KILOMETER_PER_DAY'              => array(array('' => '1000', '/' => '86400'),       'km/day'),
0145         'KILOMETER_PER_HOUR'             => array(array('' => '1000', '/' => '3600'),        'km/h'),
0146         'KILOMETER_PER_MINUTE'           => array(array('' => '1000', '/' => '60'),          'km/m'),
0147         'KILOMETER_PER_SECOND'           => array('1000',                                  'km/s'),
0148         'KNOT'                           => array(array('' => '1852', '/' => '3600'),        'kn'),
0149         'LEAGUE_PER_DAY'                 => array(array('' => '4828.0417', '/' => '86400'),  'league/day'),
0150         'LEAGUE_PER_HOUR'                => array(array('' => '4828.0417', '/' => '3600'),   'league/h'),
0151         'LEAGUE_PER_MINUTE'              => array(array('' => '4828.0417', '/' => '60'),     'league/m'),
0152         'LEAGUE_PER_SECOND'              => array('4828.0417',                             'league/s'),
0153         'MACH'                           => array('340.29',                                'M'),
0154         'MEGAMETER_PER_DAY'              => array(array('' => '1000000', '/' => '86400'),    'Mm/day'),
0155         'MEGAMETER_PER_HOUR'             => array(array('' => '1000000', '/' => '3600'),     'Mm/h'),
0156         'MEGAMETER_PER_MINUTE'           => array(array('' => '1000000', '/' => '60'),       'Mm/m'),
0157         'MEGAMETER_PER_SECOND'           => array('1000000',                               'Mm/s'),
0158         'METER_PER_DAY'                  => array(array('' => '1', '/' => '86400'),          'm/day'),
0159         'METER_PER_HOUR'                 => array(array('' => '1', '/' => '3600'),           'm/h'),
0160         'METER_PER_MINUTE'               => array(array('' => '1', '/' => '60'),             'm/m'),
0161         'METER_PER_SECOND'               => array('1',                                     'm/s'),
0162         'MILE_PER_DAY'                   => array(array('' => '1609.344', '/' => '86400'),   'mi/day'),
0163         'MILE_PER_HOUR'                  => array(array('' => '1609.344', '/' => '3600'),    'mi/h'),
0164         'MILE_PER_MINUTE'                => array(array('' => '1609.344', '/' => '60'),      'mi/m'),
0165         'MILE_PER_SECOND'                => array('1609.344',                              'mi/s'),
0166         'MILLIMETER_PER_DAY'             => array(array('' => '0.001', '/' => '86400'),      'mm/day'),
0167         'MILLIMETER_PER_HOUR'            => array(array('' => '0.001', '/' => '3600'),       'mm/h'),
0168         'MILLIMETER_PER_MINUTE'          => array(array('' => '0.001', '/' => '60'),         'mm/m'),
0169         'MILLIMETER_PER_SECOND'          => array('0.001',                                 'mm/s'),
0170         'MILLIMETER_PER_MICROSECOND'     => array('1000',                                  'mm/µs'),
0171         'MILLIMETER_PER_100_MICROSECOND' => array('10',                                    'mm/100µs'),
0172         'NAUTIC_MILE_PER_DAY'            => array(array('' => '1852', '/' => '86400'),       'nmi/day'),
0173         'NAUTIC_MILE_PER_HOUR'           => array(array('' => '1852', '/' => '3600'),        'nmi/h'),
0174         'NAUTIC_MILE_PER_MINUTE'         => array(array('' => '1852', '/' => '60'),          'nmi/m'),
0175         'NAUTIC_MILE_PER_SECOND'         => array('1852',                                  'nmi/s'),
0176         'LIGHTSPEED_AIR'                 => array('299702547',                             'speed of light (air)'),
0177         'LIGHTSPEED_GLASS'               => array('199861638',                             'speed of light (glass)'),
0178         'LIGHTSPEED_ICE'                 => array('228849204',                             'speed of light (ice)'),
0179         'LIGHTSPEED_VACUUM'              => array('299792458',                             'speed of light (vacuum)'),
0180         'LIGHTSPEED_WATER'               => array('225407863',                             'speed of light (water)'),
0181         'SOUNDSPEED_AIT'                 => array('340.29',                                'speed of sound (air)'),
0182         'SOUNDSPEED_METAL'               => array('5000',                                  'speed of sound (metal)'),
0183         'SOUNDSPEED_WATER'               => array('1500',                                  'speed of sound (water)'),
0184         'YARD_PER_DAY'                   => array(array('' => '0.9144', '/' => '86400'),     'yd/day'),
0185         'YARD_PER_HOUR'                  => array(array('' => '0.9144', '/' => '3600'),      'yd/h'),
0186         'YARD_PER_MINUTE'                => array(array('' => '0.9144', '/' => '60'),        'yd/m'),
0187         'YARD_PER_SECOND'                => array('0.9144',                                'yd/s'),
0188         'STANDARD'                       => 'METER_PER_SECOND'
0189     );
0190 }