blob: 12d828fc574c0d5d5fab559075a3e8c6258e4bac [file] [log] [blame]
avm9996399bb77c2020-01-27 03:15:08 +01001<?php
2# Generated by the protocol buffer compiler. DO NOT EDIT!
3# source: proto/gtfs.proto
4
5namespace Gtfs\FareAttribute;
6
7use UnexpectedValueException;
8
9/**
10 * Protobuf type <code>gtfs.FareAttribute.PaymentMethod</code>
11 */
12class 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.
50class_alias(PaymentMethod::class, \Gtfs\FareAttribute_PaymentMethod::class);
51