30 lines
754 B
PHP
30 lines
754 B
PHP
<?php
|
|
|
|
namespace App\Services\SmsBilling;
|
|
|
|
class SmsSendResult
|
|
{
|
|
public function __construct(
|
|
public readonly bool $sent,
|
|
public readonly bool $blocked = false,
|
|
public readonly ?string $provider = null,
|
|
public readonly ?string $errorMessage = null,
|
|
) {
|
|
}
|
|
|
|
public static function blocked(): self
|
|
{
|
|
return new self(sent: false, blocked: true, errorMessage: 'ارسال پیامک موقتاً غیرفعال است');
|
|
}
|
|
|
|
public static function failed(?string $message = null): self
|
|
{
|
|
return new self(sent: false, errorMessage: $message);
|
|
}
|
|
|
|
public static function success(string $provider): self
|
|
{
|
|
return new self(sent: true, provider: $provider);
|
|
}
|
|
}
|