* Coding Standard patch

This commit is contained in:
Vasilij Dusko | CREATION 2021-04-01 13:35:26 +03:00
parent 1ff97e410a
commit 83d259832b

View File

@ -33,46 +33,46 @@ final class LightSmsTransport extends AbstractTransport
private $from; private $from;
private const ERROR_CODES = [ private const ERROR_CODES = [
000 => 'Service unavailable', 000 => 'Service unavailable',
1 => 'Missing Signature', 1 => 'Missing Signature',
2 => 'Login not specified', 2 => 'Login not specified',
3 => 'Text not specified', 3 => 'Text not specified',
4 => 'Phone number not specified', 4 => 'Phone number not specified',
5 => 'Sender not specified', 5 => 'Sender not specified',
6 => 'Invalid signature', 6 => 'Invalid signature',
7 => 'Invalid login', 7 => 'Invalid login',
8 => 'Invalid sender name', 8 => 'Invalid sender name',
9 => 'Sender name not registered', 9 => 'Sender name not registered',
10 => 'Sender name not approved', 10 => 'Sender name not approved',
11 => 'There are forbidden words in the text', 11 => 'There are forbidden words in the text',
12 => 'Error in SMS sending', 12 => 'Error in SMS sending',
13 => 'Phone number is in the blackist. SMS sending to this number is forbidden.', 13 => 'Phone number is in the blackist. SMS sending to this number is forbidden.',
14 => 'There are more than 50 numbers in the request', 14 => 'There are more than 50 numbers in the request',
15 => 'List not specified', 15 => 'List not specified',
16 => 'Invalid phone number', 16 => 'Invalid phone number',
17 => 'SMS ID not specified', 17 => 'SMS ID not specified',
18 => 'Status not obtained', 18 => 'Status not obtained',
19 => 'Empty response', 19 => 'Empty response',
20 => 'The number already exists', 20 => 'The number already exists',
21 => 'No name', 21 => 'No name',
22 => 'Template already exists', 22 => 'Template already exists',
23 => 'Missing Month (Format: YYYY-MM)', 23 => 'Missing Month (Format: YYYY-MM)',
24 => 'Timestamp not specified', 24 => 'Timestamp not specified',
25 => 'Error in access to the list', 25 => 'Error in access to the list',
26 => 'There are no numbers in the list', 26 => 'There are no numbers in the list',
27 => 'No valid numbers', 27 => 'No valid numbers',
28 => 'Missing start date (Format: YYYY-MM-DD)', 28 => 'Missing start date (Format: YYYY-MM-DD)',
29 => 'Missing end date (Format: YYYY-MM-DD)', 29 => 'Missing end date (Format: YYYY-MM-DD)',
30 => 'No date (format: YYYY-MM-DD)', 30 => 'No date (format: YYYY-MM-DD)',
31 => 'Closing direction to the user', 31 => 'Closing direction to the user',
32 => 'Not enough money', 32 => 'Not enough money',
33 => 'Missing phone number', 33 => 'Missing phone number',
34 => 'Phone is in stop list', 34 => 'Phone is in stop list',
35 => 'Not enough money', 35 => 'Not enough money',
36 => 'Can not obtain information about phone', 36 => 'Can not obtain information about phone',
37 => 'Base Id is not set', 37 => 'Base Id is not set',
38 => 'Phone number already exists in this database', 38 => 'Phone number already exists in this database',
39 => 'Phone number does not exist in this database', 39 => 'Phone number does not exist in this database',
]; ];
public function __construct(string $login, string $password, string $from, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null) public function __construct(string $login, string $password, string $from, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null)
@ -102,11 +102,11 @@ final class LightSmsTransport extends AbstractTransport
$timestamp = time(); $timestamp = time();
$data = [ $data = [
'login' => $this->login, 'login' => $this->login,
'phone' => $this->escapePhoneNumber($message->getPhone()), 'phone' => $this->escapePhoneNumber($message->getPhone()),
'text' => $message->getSubject(), 'text' => $message->getSubject(),
'sender' => $this->from, 'sender' => $this->from,
'timestamp' => $timestamp 'timestamp' => $timestamp,
]; ];
$data['signature'] = $this->generateSignature($data, $timestamp); $data['signature'] = $this->generateSignature($data, $timestamp);
$endpoint = 'https://'.$this->getEndpoint().'/external/get/send.php?'.http_build_query($data); $endpoint = 'https://'.$this->getEndpoint().'/external/get/send.php?'.http_build_query($data);