avm99963 | 99bb77c | 2020-01-27 03:15:08 +0100 | [diff] [blame^] | 1 | <?php |
| 2 | # Generated by the protocol buffer compiler. DO NOT EDIT! |
| 3 | # source: proto/gtfs.proto |
| 4 | |
| 5 | namespace Gtfs\StopTime; |
| 6 | |
| 7 | use UnexpectedValueException; |
| 8 | |
| 9 | /** |
| 10 | * Protobuf type <code>gtfs.StopTime.AvailabilityType</code> |
| 11 | */ |
| 12 | class AvailabilityType |
| 13 | { |
| 14 | /** |
| 15 | * Tram, Streetcar, Light rail. Any light rail or street level system within a metropolitan area. |
| 16 | * |
| 17 | * Generated from protobuf enum <code>REGULAR = 0;</code> |
| 18 | */ |
| 19 | const REGULAR = 0; |
| 20 | /** |
| 21 | * Subway, Metro. Any underground rail system within a metropolitan area. |
| 22 | * |
| 23 | * Generated from protobuf enum <code>NOT_AVAILABLE = 1;</code> |
| 24 | */ |
| 25 | const NOT_AVAILABLE = 1; |
| 26 | /** |
| 27 | * Rail. Used for intercity or long-distance travel. |
| 28 | * |
| 29 | * Generated from protobuf enum <code>PHONE = 2;</code> |
| 30 | */ |
| 31 | const PHONE = 2; |
| 32 | /** |
| 33 | * Bus. Used for short- and long-distance bus routes. |
| 34 | * |
| 35 | * Generated from protobuf enum <code>DRIVER = 3;</code> |
| 36 | */ |
| 37 | const DRIVER = 3; |
| 38 | |
| 39 | private static $valueToName = [ |
| 40 | self::REGULAR => 'REGULAR', |
| 41 | self::NOT_AVAILABLE => 'NOT_AVAILABLE', |
| 42 | self::PHONE => 'PHONE', |
| 43 | self::DRIVER => 'DRIVER', |
| 44 | ]; |
| 45 | |
| 46 | public static function name($value) |
| 47 | { |
| 48 | if (!isset(self::$valueToName[$value])) { |
| 49 | throw new UnexpectedValueException(sprintf( |
| 50 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); |
| 51 | } |
| 52 | return self::$valueToName[$value]; |
| 53 | } |
| 54 | |
| 55 | |
| 56 | public static function value($name) |
| 57 | { |
| 58 | $const = __CLASS__ . '::' . strtoupper($name); |
| 59 | if (!defined($const)) { |
| 60 | throw new UnexpectedValueException(sprintf( |
| 61 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); |
| 62 | } |
| 63 | return constant($const); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | // Adding a class alias for backwards compatibility with the previous class name. |
| 68 | class_alias(AvailabilityType::class, \Gtfs\StopTime_AvailabilityType::class); |
| 69 | |