Option.php 4.32 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/protobuf/type.proto

namespace Google\Protobuf;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * A protocol buffer option, which can be attached to a message, field,
 * enumeration, etc.
 *
 * Generated from protobuf message <code>google.protobuf.Option</code>
 */
class Option extends \Google\Protobuf\Internal\Message
{
    /**
     * The option's name. For protobuf built-in options (options defined in
     * descriptor.proto), this is the short name. For example, `"map_entry"`.
     * For custom options, it should be the fully-qualified name. For example,
     * `"google.api.http"`.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     */
    private $name = '';
    /**
     * The option's value packed in an Any message. If the value is a primitive,
     * the corresponding wrapper type defined in google/protobuf/wrappers.proto
     * should be used. If the value is an enum, it should be stored as an int32
     * value using the google.protobuf.Int32Value type.
     *
     * Generated from protobuf field <code>.google.protobuf.Any value = 2;</code>
     */
    private $value = null;

38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           The option's name. For protobuf built-in options (options defined in
     *           descriptor.proto), this is the short name. For example, `"map_entry"`.
     *           For custom options, it should be the fully-qualified name. For example,
     *           `"google.api.http"`.
     *     @type \Google\Protobuf\Any $value
     *           The option's value packed in an Any message. If the value is a primitive,
     *           the corresponding wrapper type defined in google/protobuf/wrappers.proto
     *           should be used. If the value is an enum, it should be stored as an int32
     *           value using the google.protobuf.Int32Value type.
     * }
     */
    public function __construct($data = NULL) {
57
        \GPBMetadata\Google\Protobuf\Type::initOnce();
58
        parent::__construct($data);
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
    }

    /**
     * The option's name. For protobuf built-in options (options defined in
     * descriptor.proto), this is the short name. For example, `"map_entry"`.
     * For custom options, it should be the fully-qualified name. For example,
     * `"google.api.http"`.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * The option's name. For protobuf built-in options (options defined in
     * descriptor.proto), this is the short name. For example, `"map_entry"`.
     * For custom options, it should be the fully-qualified name. For example,
     * `"google.api.http"`.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * The option's value packed in an Any message. If the value is a primitive,
     * the corresponding wrapper type defined in google/protobuf/wrappers.proto
     * should be used. If the value is an enum, it should be stored as an int32
     * value using the google.protobuf.Int32Value type.
     *
     * Generated from protobuf field <code>.google.protobuf.Any value = 2;</code>
     * @return \Google\Protobuf\Any
     */
    public function getValue()
    {
        return $this->value;
    }

    /**
     * The option's value packed in an Any message. If the value is a primitive,
     * the corresponding wrapper type defined in google/protobuf/wrappers.proto
     * should be used. If the value is an enum, it should be stored as an int32
     * value using the google.protobuf.Int32Value type.
     *
     * Generated from protobuf field <code>.google.protobuf.Any value = 2;</code>
     * @param \Google\Protobuf\Any $var
     * @return $this
     */
    public function setValue($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Any::class);
        $this->value = $var;

        return $this;
    }

}