mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
32 lines
627 B
PHP
32 lines
627 B
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Wallets\Services;
|
|
|
|
|
|
class GeneratesWalletCode
|
|
{
|
|
|
|
/** @var ChecksIfWalletCodeExists */
|
|
private $walletCodeExists;
|
|
|
|
/**
|
|
* GeneratesWalletCode constructor.
|
|
* @param ChecksIfWalletCodeExists $walletCodeExists
|
|
*/
|
|
public function __construct(ChecksIfWalletCodeExists $walletCodeExists)
|
|
{
|
|
$this->walletCodeExists = $walletCodeExists;
|
|
}
|
|
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function execute(): int {
|
|
|
|
$code = mt_rand(100000001, 999999999);
|
|
return !$this->walletCodeExists->execute($code) ? $code : self::execute();
|
|
|
|
}
|
|
|
|
} |