Automattic\WooCommerce\Vendor\GraphQL\Utils

PhpDoc::unwrappublic staticWC 1.0

Method of the class: PhpDoc{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = PhpDoc::unwrap( $docBlock ): ?string;
$docBlock(string|false|null) (required)
.

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);
}