| 1 | <?php |
||
| 7 | class Length extends Quantity { |
||
| 8 | |||
| 9 | // The base unit for the `$units` conversion table |
||
| 10 | const BASE_UNIT = 'm'; |
||
| 11 | |||
| 12 | // New objects will convert to this unit |
||
| 13 | static public $default_unit = self::BASE_UNIT; |
||
| 14 | |||
| 15 | // Conversion table for this Quantity |
||
| 16 | static public $units = array( |
||
| 17 | 'm' => 1, // base |
||
| 18 | 'km' => 1000, |
||
| 19 | 'ml' => 1609.344, |
||
| 20 | 'yd' => 0.9144, |
||
| 21 | 'ft' => 0.3048, |
||
| 22 | 'in' => 25.4, |
||
| 23 | ); |
||
| 24 | |||
| 25 | /** |
||
| 26 | * The convertor heart, that every sub class needs |
||
| 27 | */ |
||
| 28 | protected function convertor( $toUnit ) { |
||
| 31 | |||
| 32 | } |
||
| 33 |