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.Transfers</code> |
| 11 | */ |
| 12 | class Transfers |
| 13 | { |
| 14 | /** |
| 15 | * Generated from protobuf enum <code>NO = 0;</code> |
| 16 | */ |
| 17 | const NO = 0; |
| 18 | /** |
| 19 | * Generated from protobuf enum <code>ONCE = 1;</code> |
| 20 | */ |
| 21 | const ONCE = 1; |
| 22 | /** |
| 23 | * Generated from protobuf enum <code>TWICE = 2;</code> |
| 24 | */ |
| 25 | const TWICE = 2; |
| 26 | /** |
| 27 | * Generated from protobuf enum <code>UNLIMITED = 3;</code> |
| 28 | */ |
| 29 | const UNLIMITED = 3; |
| 30 | |
| 31 | private static $valueToName = [ |
| 32 | self::NO => 'NO', |
| 33 | self::ONCE => 'ONCE', |
| 34 | self::TWICE => 'TWICE', |
| 35 | self::UNLIMITED => 'UNLIMITED', |
| 36 | ]; |
| 37 | |
| 38 | public static function name($value) |
| 39 | { |
| 40 | if (!isset(self::$valueToName[$value])) { |
| 41 | throw new UnexpectedValueException(sprintf( |
| 42 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); |
| 43 | } |
| 44 | return self::$valueToName[$value]; |
| 45 | } |
| 46 | |
| 47 | |
| 48 | public static function value($name) |
| 49 | { |
| 50 | $const = __CLASS__ . '::' . strtoupper($name); |
| 51 | if (!defined($const)) { |
| 52 | throw new UnexpectedValueException(sprintf( |
| 53 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); |
| 54 | } |
| 55 | return constant($const); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | // Adding a class alias for backwards compatibility with the previous class name. |
| 60 | class_alias(Transfers::class, \Gtfs\FareAttribute_Transfers::class); |
| 61 | |