@@ -62,7 +62,7 @@ final class LightSmsTransport extends AbstractTransport
6262 '22 ' => 'Template already exists ' ,
6363 '23 ' => 'Month not specifies (Format: YYYY-MM) ' ,
6464 '24 ' => 'Timestamp not specified ' ,
65- '25 ' =>'Error in access to the list ' ,
65+ '25 ' => 'Error in access to the list ' ,
6666 '26 ' => 'There are no numbers in the list ' ,
6767 '27 ' => 'No valid numbers ' ,
6868 '28 ' => 'Date of start not specified (Format: YYYY-MM-DD) ' ,
@@ -101,7 +101,6 @@ public function __toString(): string
101101 public function supports (MessageInterface $ message ): bool
102102 {
103103 return $ message instanceof SmsMessage;
104-
105104 }
106105
107106 protected function doSend (MessageInterface $ message ): SentMessage
@@ -125,7 +124,6 @@ protected function doSend(MessageInterface $message): SentMessage
125124 time ()
126125 );
127126
128-
129127 $ response = $ this ->client ->request ('GET ' , $ endpoint );
130128
131129 $ content = $ response ->toArray (false );
@@ -134,22 +132,21 @@ protected function doSend(MessageInterface $message): SentMessage
134132 throw new TransportException ('Unable to send the SMS: ' .$ this ->errorCodes [$ content ['error ' ]], $ response );
135133 }
136134
137-
138135 $ phone = preg_replace ("/[^\d]/ " , "" , $ message ->getPhone ());
139-
140- if ($ content [$ phone ]['error ' ] == 32 ) {
136+ if (32 == $ content [$ phone ]['error ' ]) {
141137 throw new TransportException ('Unable to send the SMS: ' .$ this ->errorCodes [$ content ['error ' ]], $ response );
142138 }
143139
144- if ($ content [$ phone ]['error ' ] == 0 ) {
140+ if (0 == $ content [$ phone ]['error ' ]) {
145141 $ sentMessage = new SentMessage ($ message , (string ) $ this );
146142 $ sentMessage ->setMessageId ($ content [$ phone ]['id_sms ' ]);
147143 }
144+
145+ return $ sentMessage ;
148146 }
149147
150148 private function getSignature (): string
151149 {
152-
153150 $ params = [
154151 'timestamp ' => time (),
155152 'login ' => $ this ->login ,
@@ -161,6 +158,6 @@ private function getSignature(): string
161158 ksort ($ params );
162159 reset ($ params );
163160
164- return md5 (implode ($ params ) . $ this ->password );
161+ return md5 (implode ('' , $ params ). $ this ->password );
165162 }
166163}
0 commit comments