function AnyBase::is
This method returns whether the type_url in any_message is corresponded to the given class.
Parameters
string $klass The fully qualified PHP class name of a proto message type.:
File
-
vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ AnyBase.php, line 78
Class
- AnyBase
- Base class for Google\Protobuf\Any, this contains hand-written convenience methods like pack() and unpack().
Namespace
Google\Protobuf\InternalCode
public function is($klass) {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
$desc = $pool->getDescriptorByClassName($klass);
$fully_qualified_name = $desc->getFullName();
$type_url = GPBUtil::TYPE_URL_PREFIX . $fully_qualified_name;
return $this->type_url === $type_url;
}