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\FareAttribute; |
| 6 | |
| 7 | use UnexpectedValueException; |
| 8 | |
| 9 | /** |
| 10 | * Protobuf type <code>gtfs.FareAttribute.PaymentMethod</code> |
| 11 | */ |
| 12 | class PaymentMethod |
| 13 | { |
| 14 | /** |
| 15 | * Generated from protobuf enum <code>ONBOARD = 0;</code> |
| 16 | */ |
| 17 | const ONBOARD = 0; |
| 18 | /** |
| 19 | * Generated from protobuf enum <code>PREBOARDING = 1;</code> |
| 20 | */ |
| 21 | const PREBOARDING = 1; |
| 22 | |
| 23 | private static $valueToName = [ |
| 24 | self::ONBOARD => 'ONBOARD', |
| 25 | self::PREBOARDING => 'PREBOARDING', |
| 26 | ]; |
| 27 | |
| 28 | public static function name($value) |
| 29 | { |
| 30 | if (!isset(self::$valueToName[$value])) { |
| 31 | throw new UnexpectedValueException(sprintf( |
| 32 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); |
| 33 | } |
| 34 | return self::$valueToName[$value]; |
| 35 | } |
| 36 | |
| 37 | |
| 38 | public static function value($name) |
| 39 | { |
| 40 | $const = __CLASS__ . '::' . strtoupper($name); |
| 41 | if (!defined($const)) { |
| 42 | throw new UnexpectedValueException(sprintf( |
| 43 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); |
| 44 | } |
| 45 | return constant($const); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | // Adding a class alias for backwards compatibility with the previous class name. |
| 50 | class_alias(PaymentMethod::class, \Gtfs\FareAttribute_PaymentMethod::class); |
| 51 | |