Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/friendsofphp/php-cs-fixer/src/Documentation/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/friendsofphp/php-cs-fixer/src/Documentation/RstUtils.php
<?php

declare(strict_types=1);

/*
 * This file is part of PHP CS Fixer.
 *
 * (c) Fabien Potencier <[email protected]>
 *     Dariusz RumiƄski <[email protected]>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace PhpCsFixer\Documentation;

use PhpCsFixer\Preg;

/**
 * @internal
 */
final class RstUtils
{
    private function __construct()
    {
        // cannot create instance of util. class
    }

    public static function toRst(string $string, int $indent = 0): string
    {
        $string = wordwrap(self::ensureProperInlineCode($string), 80 - $indent);

        return 0 === $indent ? $string : self::indent($string, $indent);
    }

    public static function ensureProperInlineCode(string $string): string
    {
        return Preg::replace('/(?<!`)(`[^`]+`)(?!`)/', '`$1`', $string);
    }

    public static function indent(string $string, int $indent): string
    {
        return Preg::replace('/(\n)(?!\n|$)/', '$1'.str_repeat(' ', $indent), $string);
    }
}

Spamworldpro Mini