blob: 0df27b53359dd3b03d00819e05562969be14dd19 [file] [log] [blame]
avm9996399bb77c2020-01-27 03:15:08 +01001<?php
2# Generated by the protocol buffer compiler. DO NOT EDIT!
3# source: google/protobuf/descriptor.proto
4
5namespace Google\Protobuf\Internal\FileOptions;
6
7use UnexpectedValueException;
8
9/**
10 * Generated classes can be optimized for speed or code size.
11 *
12 * Protobuf type <code>google.protobuf.FileOptions.OptimizeMode</code>
13 */
14class OptimizeMode
15{
16 /**
17 * Generate complete code for parsing, serialization,
18 *
19 * Generated from protobuf enum <code>SPEED = 1;</code>
20 */
21 const SPEED = 1;
22 /**
23 * etc.
24 *
25 * Generated from protobuf enum <code>CODE_SIZE = 2;</code>
26 */
27 const CODE_SIZE = 2;
28 /**
29 * Generate code using MessageLite and the lite runtime.
30 *
31 * Generated from protobuf enum <code>LITE_RUNTIME = 3;</code>
32 */
33 const LITE_RUNTIME = 3;
34
35 private static $valueToName = [
36 self::SPEED => 'SPEED',
37 self::CODE_SIZE => 'CODE_SIZE',
38 self::LITE_RUNTIME => 'LITE_RUNTIME',
39 ];
40
41 public static function name($value)
42 {
43 if (!isset(self::$valueToName[$value])) {
44 throw new UnexpectedValueException(sprintf(
45 'Enum %s has no name defined for value %s', __CLASS__, $value));
46 }
47 return self::$valueToName[$value];
48 }
49
50
51 public static function value($name)
52 {
53 $const = __CLASS__ . '::' . strtoupper($name);
54 if (!defined($const)) {
55 throw new UnexpectedValueException(sprintf(
56 'Enum %s has no value defined for name %s', __CLASS__, $name));
57 }
58 return constant($const);
59 }
60}
61
62// Adding a class alias for backwards compatibility with the previous class name.
63class_alias(OptimizeMode::class, \Google\Protobuf\Internal\FileOptions_OptimizeMode::class);
64