Automattic\WooCommerce\Vendor\GraphQL\Utils
PhpDoc::unwrap
Method of the class: PhpDoc{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = PhpDoc::unwrap( $docBlock ): ?string;
- $docBlock(string|false|null) (required)
- .
PhpDoc::unwrap() PhpDoc::unwrap code WC 10.9.1
public static function unwrap($docBlock): ?string
{
if ($docBlock === false || $docBlock === null) {
return null;
}
$content = preg_replace('~([\r\n]) \* (.*)~i', '$1$2', $docBlock); // strip *
assert(is_string($content), 'regex is statically known to be valid');
$content = preg_replace('~([\r\n])[\* ]+([\r\n])~i', '$1$2', $content); // strip single-liner *
assert(is_string($content), 'regex is statically known to be valid');
$content = substr($content, 3); // strip leading /**
$content = substr($content, 0, -2); // strip trailing */
return static::nonEmptyOrNull($content);
}