media-cloud-sync
/
includes
/
sdk
/
google
/
google
/
protobuf
/
src
/
Google
/
Protobuf
/
DescriptorPool.php
DescriptorPool.php in Media Cloud Sync 1.0.1, at includes/sdk/google/google/protobuf/src/Google/Protobuf/DescriptorPool.php
| 1 | <?php |
| 2 | |
| 3 | // Protocol Buffers - Google's data interchange format |
| 4 | // Copyright 2017 Google Inc. All rights reserved. |
| 5 | // |
| 6 | // Use of this source code is governed by a BSD-style |
| 7 | // license that can be found in the LICENSE file or at |
| 8 | // https://developers.google.com/open-source/licenses/bsd |
| 9 | namespace Dudlewebs\WPMCS\Google\Protobuf; |
| 10 | |
| 11 | class DescriptorPool |
| 12 | { |
| 13 | private static $pool; |
| 14 | private $internal_pool; |
| 15 | /** |
| 16 | * @return DescriptorPool |
| 17 | */ |
| 18 | public static function getGeneratedPool() |
| 19 | { |
| 20 | if (!isset(self::$pool)) { |
| 21 | self::$pool = new DescriptorPool(\Dudlewebs\WPMCS\Google\Protobuf\Internal\DescriptorPool::getGeneratedPool()); |
| 22 | } |
| 23 | return self::$pool; |
| 24 | } |
| 25 | private function __construct($internal_pool) |
| 26 | { |
| 27 | $this->internal_pool = $internal_pool; |
| 28 | } |
| 29 | /** |
| 30 | * @param string $className A fully qualified protobuf class name |
| 31 | * @return Descriptor |
| 32 | */ |
| 33 | public function getDescriptorByClassName($className) |
| 34 | { |
| 35 | $desc = $this->internal_pool->getDescriptorByClassName($className); |
| 36 | return is_null($desc) ? null : $desc->getPublicDescriptor(); |
| 37 | } |
| 38 | /** |
| 39 | * @param string $className A fully qualified protobuf class name |
| 40 | * @return EnumDescriptor |
| 41 | */ |
| 42 | public function getEnumDescriptorByClassName($className) |
| 43 | { |
| 44 | $desc = $this->internal_pool->getEnumDescriptorByClassName($className); |
| 45 | return is_null($desc) ? null : $desc->getPublicDescriptor(); |
| 46 | } |
| 47 | } |
| 48 |