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