You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.2 KiB
46 lines
1.2 KiB
<?php
|
|
|
|
namespace App\Services\Sms;
|
|
|
|
class SmsSendResult
|
|
{
|
|
/**
|
|
* @param array<string, mixed>|null $response
|
|
*/
|
|
public function __construct(
|
|
public readonly bool $success,
|
|
public readonly string $provider,
|
|
public readonly ?string $requestId = null,
|
|
public readonly ?string $providerCode = null,
|
|
public readonly ?string $providerMessage = null,
|
|
public readonly ?array $response = null,
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* @param array<string, mixed>|null $response
|
|
*/
|
|
public static function success(
|
|
string $provider,
|
|
?string $requestId = null,
|
|
?string $providerCode = null,
|
|
?string $providerMessage = null,
|
|
?array $response = null,
|
|
): self {
|
|
return new self(true, $provider, $requestId, $providerCode, $providerMessage, $response);
|
|
}
|
|
|
|
/**
|
|
* @param array<string, mixed>|null $response
|
|
*/
|
|
public static function failure(
|
|
string $provider,
|
|
?string $requestId = null,
|
|
?string $providerCode = null,
|
|
?string $providerMessage = null,
|
|
?array $response = null,
|
|
): self {
|
|
return new self(false, $provider, $requestId, $providerCode, $providerMessage, $response);
|
|
}
|
|
}
|