@@ -62,7 +62,7 @@ final class LightSmsTransport extends AbstractTransport
62
62
'22 ' => 'Template already exists ' ,
63
63
'23 ' => 'Month not specifies (Format: YYYY-MM) ' ,
64
64
'24 ' => 'Timestamp not specified ' ,
65
- '25 ' =>'Error in access to the list ' ,
65
+ '25 ' => 'Error in access to the list ' ,
66
66
'26 ' => 'There are no numbers in the list ' ,
67
67
'27 ' => 'No valid numbers ' ,
68
68
'28 ' => 'Date of start not specified (Format: YYYY-MM-DD) ' ,
@@ -101,7 +101,6 @@ public function __toString(): string
101
101
public function supports (MessageInterface $ message ): bool
102
102
{
103
103
return $ message instanceof SmsMessage;
104
-
105
104
}
106
105
107
106
protected function doSend (MessageInterface $ message ): SentMessage
@@ -125,7 +124,6 @@ protected function doSend(MessageInterface $message): SentMessage
125
124
time ()
126
125
);
127
126
128
-
129
127
$ response = $ this ->client ->request ('GET ' , $ endpoint );
130
128
131
129
$ content = $ response ->toArray (false );
@@ -134,22 +132,21 @@ protected function doSend(MessageInterface $message): SentMessage
134
132
throw new TransportException ('Unable to send the SMS: ' .$ this ->errorCodes [$ content ['error ' ]], $ response );
135
133
}
136
134
137
-
138
135
$ phone = preg_replace ("/[^\d]/ " , "" , $ message ->getPhone ());
139
-
140
- if ($ content [$ phone ]['error ' ] == 32 ) {
136
+ if (32 == $ content [$ phone ]['error ' ]) {
141
137
throw new TransportException ('Unable to send the SMS: ' .$ this ->errorCodes [$ content ['error ' ]], $ response );
142
138
}
143
139
144
- if ($ content [$ phone ]['error ' ] == 0 ) {
140
+ if (0 == $ content [$ phone ]['error ' ]) {
145
141
$ sentMessage = new SentMessage ($ message , (string ) $ this );
146
142
$ sentMessage ->setMessageId ($ content [$ phone ]['id_sms ' ]);
147
143
}
144
+
145
+ return $ sentMessage ;
148
146
}
149
147
150
148
private function getSignature (): string
151
149
{
152
-
153
150
$ params = [
154
151
'timestamp ' => time (),
155
152
'login ' => $ this ->login ,
@@ -161,6 +158,6 @@ private function getSignature(): string
161
158
ksort ($ params );
162
159
reset ($ params );
163
160
164
- return md5 (implode ($ params ) . $ this ->password );
161
+ return md5 (implode ('' , $ params ). $ this ->password );
165
162
}
166
163
}
0 commit comments