getConstants()) as $constant) { self::$constants[$constant] = true; } } return array_keys(self::$constants); } public function offsetSet($name, $value) { $constants = self::getConstantValues(); if (is_null($name) || !in_array($name, $constants)) { throw new InvalidArgumentException('MetadataEnvelope fields must' . ' must match a predefined offset; use the header constants.'); } $this->data[$name] = $value; } public function jsonSerialize() { return $this->data; } }