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\Route; |
| 6 | |
| 7 | use UnexpectedValueException; |
| 8 | |
| 9 | /** |
| 10 | * The route_type field describes the type of transportation used on a route. |
| 11 | * |
| 12 | * Protobuf type <code>gtfs.Route.RouteType</code> |
| 13 | */ |
| 14 | class RouteType |
| 15 | { |
| 16 | /** |
| 17 | * Tram, Streetcar, Light rail. Any light rail or street level system within a metropolitan area. |
| 18 | * |
| 19 | * Generated from protobuf enum <code>TRAM = 0;</code> |
| 20 | */ |
| 21 | const TRAM = 0; |
| 22 | /** |
| 23 | * Subway, Metro. Any underground rail system within a metropolitan area. |
| 24 | * |
| 25 | * Generated from protobuf enum <code>SUBWAY = 1;</code> |
| 26 | */ |
| 27 | const SUBWAY = 1; |
| 28 | /** |
| 29 | * Rail. Used for intercity or long-distance travel. |
| 30 | * |
| 31 | * Generated from protobuf enum <code>RAIL = 2;</code> |
| 32 | */ |
| 33 | const RAIL = 2; |
| 34 | /** |
| 35 | * Bus. Used for short- and long-distance bus routes. |
| 36 | * |
| 37 | * Generated from protobuf enum <code>BUS = 3;</code> |
| 38 | */ |
| 39 | const BUS = 3; |
| 40 | /** |
| 41 | * Ferry. Used for short- and long-distance boat service. |
| 42 | * |
| 43 | * Generated from protobuf enum <code>FERRY = 4;</code> |
| 44 | */ |
| 45 | const FERRY = 4; |
| 46 | /** |
| 47 | * Cable car. Used for street-level cable cars where the cable runs beneath the car. |
| 48 | * |
| 49 | * Generated from protobuf enum <code>CABLECAR = 5;</code> |
| 50 | */ |
| 51 | const CABLECAR = 5; |
| 52 | /** |
| 53 | * Gondola, Suspended cable car. Typically used for aerial cable cars where the car is suspended from the cable. |
| 54 | * |
| 55 | * Generated from protobuf enum <code>GONDOLA = 6;</code> |
| 56 | */ |
| 57 | const GONDOLA = 6; |
| 58 | /** |
| 59 | * Funicular. Any rail system designed for steep inclines. |
| 60 | * |
| 61 | * Generated from protobuf enum <code>FUNICULAR = 7;</code> |
| 62 | */ |
| 63 | const FUNICULAR = 7; |
| 64 | |
| 65 | private static $valueToName = [ |
| 66 | self::TRAM => 'TRAM', |
| 67 | self::SUBWAY => 'SUBWAY', |
| 68 | self::RAIL => 'RAIL', |
| 69 | self::BUS => 'BUS', |
| 70 | self::FERRY => 'FERRY', |
| 71 | self::CABLECAR => 'CABLECAR', |
| 72 | self::GONDOLA => 'GONDOLA', |
| 73 | self::FUNICULAR => 'FUNICULAR', |
| 74 | ]; |
| 75 | |
| 76 | public static function name($value) |
| 77 | { |
| 78 | if (!isset(self::$valueToName[$value])) { |
| 79 | throw new UnexpectedValueException(sprintf( |
| 80 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); |
| 81 | } |
| 82 | return self::$valueToName[$value]; |
| 83 | } |
| 84 | |
| 85 | |
| 86 | public static function value($name) |
| 87 | { |
| 88 | $const = __CLASS__ . '::' . strtoupper($name); |
| 89 | if (!defined($const)) { |
| 90 | throw new UnexpectedValueException(sprintf( |
| 91 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); |
| 92 | } |
| 93 | return constant($const); |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | // Adding a class alias for backwards compatibility with the previous class name. |
| 98 | class_alias(RouteType::class, \Gtfs\Route_RouteType::class); |
| 99 | |