Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. OptimizeMode.php

class OptimizeMode

Generated classes can be optimized for speed or code size.

Protobuf type <code>google.protobuf.FileOptions.OptimizeMode</code>

Hierarchy

  • class \Google\Protobuf\Internal\FileOptions\OptimizeMode

Expanded class hierarchy of OptimizeMode

File

vendor/google/protobuf/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php, line 14

Namespace

Google\Protobuf\Internal\FileOptions
View source
class OptimizeMode {
    
    /**
     * Generate complete code for parsing, serialization,
     *
     * Generated from protobuf enum <code>SPEED = 1;</code>
     */
    const SPEED = 1;
    
    /**
     * etc.
     *
     * Generated from protobuf enum <code>CODE_SIZE = 2;</code>
     */
    const CODE_SIZE = 2;
    
    /**
     * Generate code using MessageLite and the lite runtime.
     *
     * Generated from protobuf enum <code>LITE_RUNTIME = 3;</code>
     */
    const LITE_RUNTIME = 3;
    private static $valueToName = [
        self::SPEED => 'SPEED',
        self::CODE_SIZE => 'CODE_SIZE',
        self::LITE_RUNTIME => 'LITE_RUNTIME',
    ];
    public static function name($value) {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf('Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }
    public static function value($name) {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf('Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }

}

Members

Title Sort descending Modifiers Object type Summary
OptimizeMode::$valueToName private static property
OptimizeMode::CODE_SIZE constant etc.
OptimizeMode::LITE_RUNTIME constant Generate code using MessageLite and the lite runtime.
OptimizeMode::name public static function
OptimizeMode::SPEED constant Generate complete code for parsing, serialization,
OptimizeMode::value public static function
RSS feed
Powered by Drupal