public function offsetSet($key, $value)
    {
        $this->checkKey($this->key_type, $key);

        switch ($this->value_type) {
            case GPBType::SFIXED32:
            case GPBType::SINT32:
            case GPBType::INT32:
            case GPBType::ENUM:
                GPBUtil::checkInt32($value);
                break;
            case GPBType::FIXED32:
            case GPBType::UINT32:
                GPBUtil::checkUint32($value);
                break;
            case GPBType::SFIXED64:
            case GPBType::SINT64:
            case GPBType::INT64:
                GPBUtil::checkInt64($value);
                break;
            case GPBType::FIXED64:
            case GPBType::UINT64:
                GPBUtil::checkUint64($value);
                break;
            case GPBType::FLOAT:
                GPBUtil::checkFloat($value);
                break;
            case GPBType::DOUBLE:
                GPBUtil::checkDouble($value);
                break;
            case GPBType::BOOL:
                GPBUtil::checkBool($value);
                break;
            case GPBType::STRING:
                GPBUtil::checkString($value, true);
                break;
            case GPBType::MESSAGE:
                if (is_null($value)) {
                  trigger_error("Map element cannot be null.", E_USER_ERROR);
                }
                GPBUtil::checkMessage($value, $this->klass);
                break;
            default:
                break;
        }

        $this->container[$key] = $value;
    }
public function offsetSet($key, $value)
    {
        $this->checkKey($this->key_type, $key);

        switch ($this->value_type) {
            case GPBType::SFIXED32:
            case GPBType::SINT32:
            case GPBType::INT32:
            case GPBType::ENUM:
                GPBUtil::checkInt32($value);
                break;
            case GPBType::FIXED32:
            case GPBType::UINT32:
                GPBUtil::checkUint32($value);
                break;
            case GPBType::SFIXED64:
            case GPBType::SINT64:
            case GPBType::INT64:
                GPBUtil::checkInt64($value);
                break;
            case GPBType::FIXED64:
            case GPBType::UINT64:
                GPBUtil::checkUint64($value);
                break;
            case GPBType::FLOAT:
                GPBUtil::checkFloat($value);
                break;
            case GPBType::DOUBLE:
                GPBUtil::checkDouble($value);
                break;
            case GPBType::BOOL:
                GPBUtil::checkBool($value);
                break;
            case GPBType::STRING:
                GPBUtil::checkString($value, true);
                break;
            case GPBType::MESSAGE:
                if (is_null($value)) {
                  trigger_error("Map element cannot be null.", E_USER_ERROR);
                }
                GPBUtil::checkMessage($value, $this->klass);
                break;
            default:
                break;
        }

        $this->container[$key] = $value;
    }
public function offsetSet ( $ key , $ value ) { $ this -> checkKey ( $ this -> key_type , $ key ) ; switch ( $ this -> value_type ) { case GPBType :: SFIXED32 : case GPBType :: SINT32 : case GPBType :: INT32 : case GPBType :: ENUM : GPBUtil :: checkInt32 ( $ value ) ; break ; case GPBType :: FIXED32 : case GPBType :: UINT32 : GPBUtil :: checkUint32 ( $ value ) ; break ; case GPBType :: SFIXED64 : case GPBType :: SINT64 : case GPBType :: INT64 : GPBUtil :: checkInt64 ( $ value ) ; break ; case GPBType :: FIXED64 : case GPBType :: UINT64 : GPBUtil :: checkUint64 ( $ value ) ; break ; case GPBType :: FLOAT : GPBUtil :: checkFloat ( $ value ) ; break ; case GPBType :: DOUBLE : GPBUtil :: checkDouble ( $ value ) ; break ; case GPBType :: BOOL : GPBUtil :: checkBool ( $ value ) ; break ; case GPBType :: STRING : GPBUtil :: checkString ( $ value , true ) ; break ; case GPBType :: MESSAGE : if ( is_null ( $ value ) ) { trigger_error ( "Map element cannot be null." , E_USER_ERROR ) ; } GPBUtil :: checkMessage ( $ value , $ this -> klass ) ; break ; default : break ; } $ this -> container [ $ key ] = $ value ; }
Assign the element at the given key.

This will also be called for: $arr[$key] = $value

@param object $key The key of the element to be fetched.
@param object $value The element to be assigned.
@return void
@throws \ErrorException Invalid type for key.
@throws \ErrorException Invalid type for value.
@throws \ErrorException Non-existing key.
Assign the element at the given key .