Automattic\WooCommerce\Vendor\GraphQL\Type\Definition
PhpEnumType::extractDescription
Method of the class: PhpEnumType{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->extractDescription( \ReflectionClassConstant|\ReflectionClass $reflection ): ?string;
- \ReflectionClassConstant|\ReflectionClass $reflection(required)
- .
PhpEnumType::extractDescription() PhpEnumType::extractDescription code WC 10.9.1
protected function extractDescription(\ReflectionClassConstant|\ReflectionClass $reflection): ?string
{
$attributes = $reflection->getAttributes(Description::class);
if (count($attributes) === 1) {
return $attributes[0]->newInstance()->description;
}
if (count($attributes) > 1) {
throw new \Exception(self::MULTIPLE_DESCRIPTIONS_DISALLOWED);
}
$comment = $reflection->getDocComment();
$unpadded = PhpDoc::unpad($comment);
return PhpDoc::unwrap($unpadded);
}