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\Calendar; |
| 6 | |
| 7 | use UnexpectedValueException; |
| 8 | |
| 9 | /** |
| 10 | * Protobuf type <code>gtfs.Calendar.CalendarDay</code> |
| 11 | */ |
| 12 | class CalendarDay |
| 13 | { |
| 14 | /** |
| 15 | * Generated from protobuf enum <code>NOT_AVAILABLE = 0;</code> |
| 16 | */ |
| 17 | const NOT_AVAILABLE = 0; |
| 18 | /** |
| 19 | * Generated from protobuf enum <code>AVAILABLE = 1;</code> |
| 20 | */ |
| 21 | const AVAILABLE = 1; |
| 22 | |
| 23 | private static $valueToName = [ |
| 24 | self::NOT_AVAILABLE => 'NOT_AVAILABLE', |
| 25 | self::AVAILABLE => 'AVAILABLE', |
| 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(CalendarDay::class, \Gtfs\Calendar_CalendarDay::class); |
| 51 | |