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