8
0
Fork 0
linkmobility-php-client/src/SMS/TextRequest.php

63 Zeilen
1.4 KiB
PHP

2022-06-20 14:47:33 +02:00
<?php
/**
2022-07-13 10:50:45 +02:00
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
2022-06-20 14:47:33 +02:00
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
2022-07-13 10:50:45 +02:00
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link https://www.oxidmodule.com
2022-06-20 14:47:33 +02:00
*/
2022-07-13 10:41:23 +02:00
declare(strict_types=1);
2022-06-20 14:47:33 +02:00
namespace D3\LinkmobilityClient\SMS;
use Assert\Assert;
2023-02-02 00:07:12 +01:00
use Assert\InvalidArgumentException;
use D3\LinkmobilityClient\Request\Request;
use D3\LinkmobilityClient\Url\Url;
use D3\LinkmobilityClient\ValueObject\SmsTextMessage;
2022-06-20 14:47:33 +02:00
class TextRequest extends Request implements SmsRequestInterface
2022-06-20 14:47:33 +02:00
{
/**
2022-06-24 16:00:56 +02:00
* @return string
2022-06-20 14:47:33 +02:00
*/
public function getUri(): string
{
return (new Url())->getTextSmsUri();
2022-06-20 14:47:33 +02:00
}
/**
* @throws InvalidArgumentException
*/
2022-06-24 16:00:56 +02:00
public function validate()
2022-06-20 14:47:33 +02:00
{
parent::validate();
2022-07-13 10:41:23 +02:00
Assert::thatNullOr($this->getMessage())->isInstanceOf(SmsTextMessage::class);
2022-06-20 14:47:33 +02:00
}
/**
* @return string
*/
2022-06-24 16:00:56 +02:00
public function getResponseClass(): string
2022-06-20 14:47:33 +02:00
{
2022-06-24 16:00:56 +02:00
return Response::class;
2022-06-20 14:47:33 +02:00
}
2022-07-13 10:41:23 +02:00
public function getRawBody(): array
{
return array_merge(
parent::getRawBody(),
[
'maxSmsPerMessage' => $this->getMaxSmsPerMessage(),
'messageType' => $this->getMessageType(),
]
);
}
2022-07-13 10:41:23 +02:00
}