diff options
author | Jack Wakefield <jackwakefield91@gmail.com> | 2017-09-10 23:17:50 +0100 |
---|---|---|
committer | Paul Yang <TeBoring@users.noreply.github.com> | 2017-09-10 15:17:50 -0700 |
commit | 174c82d8cef27be5cb9d8491dd1e26d27898870b (patch) | |
tree | 88566308f3395a0990e0bd3f54cb0fbe4897daa5 /php/src/Google/Protobuf/Internal/FieldDescriptor.php | |
parent | 2ad5c0a86443f567241e0295c313baf4f0e15379 (diff) | |
download | protobuf-174c82d8cef27be5cb9d8491dd1e26d27898870b.tar.gz protobuf-174c82d8cef27be5cb9d8491dd1e26d27898870b.tar.bz2 protobuf-174c82d8cef27be5cb9d8491dd1e26d27898870b.zip |
Add well-known timestamps to JSON for PHP (#3564)
Diffstat (limited to 'php/src/Google/Protobuf/Internal/FieldDescriptor.php')
-rw-r--r-- | php/src/Google/Protobuf/Internal/FieldDescriptor.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptor.php b/php/src/Google/Protobuf/Internal/FieldDescriptor.php index 1443c6fd..6644a2e0 100644 --- a/php/src/Google/Protobuf/Internal/FieldDescriptor.php +++ b/php/src/Google/Protobuf/Internal/FieldDescriptor.php @@ -181,6 +181,12 @@ class FieldDescriptor $this->getMessageType()->getOptions()->getMapEntry(); } + public function isTimestamp() + { + return $this->getType() == GPBType::MESSAGE && + $this->getMessageType()->getClass() === "Google\Protobuf\Timestamp"; + } + private static function isTypePackable($field_type) { return ($field_type !== GPBType::STRING && |