|
Server : Apache/2.4.62 System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 User : www ( 80) PHP Version : 8.3.8 Disable Function : NONE Directory : /domains/irtiweb/careers_old/vendor/gregwar/captcha/ |
Upload File : |
<?php
namespace Gregwar\Captcha;
/**
* Generates random phrase
*
* @author Gregwar <[email protected]>
*/
class PhraseBuilder implements PhraseBuilderInterface
{
/**
* Generates random phrase of given length with given charset
*/
public function build($length = 5, $charset = 'abcdefghijklmnpqrstuvwxyz123456789')
{
$phrase = '';
$chars = str_split($charset);
for ($i = 0; $i < $length; $i++) {
$phrase .= $chars[array_rand($chars)];
}
return $phrase;
}
/**
* "Niceize" a code
*/
public function niceize($str)
{
return strtr(strtolower($str), '01', 'ol');
}
}