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/mautic.corals.io/app/bundles/CoreBundle/Helper/RandomHelper/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mautic.corals.io/app/bundles/CoreBundle/Helper/RandomHelper/RandomHelper.php
<?php

namespace Mautic\CoreBundle\Helper\RandomHelper;

final class RandomHelper implements RandomHelperInterface
{
    /**
     * Based on \Nette\Utils\Random.
     *
     * @param int    $length
     * @param string $charlist
     */
    public function generate($length = 10, $charlist = '0-9a-z'): string
    {
        $charlist = count_chars(preg_replace_callback('#.-.#', fn (array $m): string => implode('', range($m[0][0], $m[0][2])), $charlist), 3);
        $chLen    = strlen($charlist);
        if ($length < 1) {
            throw new \InvalidArgumentException('Length must be greater than zero.');
        } elseif ($chLen < 2) {
            throw new \InvalidArgumentException('Character list must contain as least two chars.');
        }
        $res = '';
        for ($i = 0; $i < $length; ++$i) {
            $res .= $charlist[random_int(0, $chLen - 1)];
        }

        return $res;
    }
}

Spamworldpro Mini