PHP 8.2.31
Preview: PhpDoc.php Size: 1.48 KB
//home/nshryvcy/radiantskinclinics.org/wp-content/plugins/woocommerce/lib/packages/GraphQL/Utils/PhpDoc.php

<?php declare(strict_types=1);

namespace Automattic\WooCommerce\Vendor\GraphQL\Utils;

class PhpDoc
{
    /** @param string|false|null $docBlock */
    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);
    }

    /** @param string|false|null $docBlock */
    public static function unpad($docBlock): ?string
    {
        if ($docBlock === false || $docBlock === null) {
            return null;
        }

        $lines = explode("\n", $docBlock);
        $lines = array_map(
            static fn (string $line): string => ' ' . trim($line),
            $lines
        );

        $content = implode("\n", $lines);

        return static::nonEmptyOrNull($content);
    }

    protected static function nonEmptyOrNull(string $maybeEmptyString): ?string
    {
        $trimmed = trim($maybeEmptyString);

        return $trimmed === ''
            ? null
            : $trimmed;
    }
}

Directory Contents

Dirs: 0 × Files: 17

Name Size Perms Modified Actions
22.85 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
23.70 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
35.02 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
19.06 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
9.93 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
1.03 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
391 B lrw-r--r-- 2026-05-05 14:26:50
Edit Download
3.68 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
5.76 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
1.32 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
1.48 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
23.58 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
18.67 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
3.72 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
15.23 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
7.98 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
9.05 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).