11<?php
22
3+ declare (strict_types=1 );
4+
35namespace NotificationChannels \Cmsms ;
46
5- use GuzzleHttp \ Client as GuzzleClient ;
7+ use SimpleXMLElement ;
68use Illuminate \Support \Arr ;
9+ use GuzzleHttp \Client as GuzzleClient ;
710use NotificationChannels \Cmsms \Exceptions \CouldNotSendNotification ;
8- use SimpleXMLElement ;
911
1012class CmsmsClient
1113{
@@ -21,7 +23,7 @@ class CmsmsClient
2123 * @param GuzzleClient $client
2224 * @param string $productToken
2325 */
24- public function __construct (GuzzleClient $ client , $ productToken )
26+ public function __construct (GuzzleClient $ client , string $ productToken )
2527 {
2628 $ this ->client = $ client ;
2729 $ this ->productToken = $ productToken ;
@@ -32,7 +34,7 @@ public function __construct(GuzzleClient $client, $productToken)
3234 * @param string $recipient
3335 * @throws CouldNotSendNotification
3436 */
35- public function send (CmsmsMessage $ message , $ recipient )
37+ public function send (CmsmsMessage $ message , string $ recipient )
3638 {
3739 if (is_null (Arr::get ($ message ->toXmlArray (), 'FROM ' ))) {
3840 $ message ->originator (config ('services.cmsms.originator ' ));
@@ -58,20 +60,20 @@ public function send(CmsmsMessage $message, $recipient)
5860 * @param string $recipient
5961 * @return string
6062 */
61- public function buildMessageXml (CmsmsMessage $ message , $ recipient )
63+ public function buildMessageXml (CmsmsMessage $ message , string $ recipient ): string
6264 {
6365 $ xml = new SimpleXMLElement ('<MESSAGES/> ' );
6466
6567 $ xml ->addChild ('AUTHENTICATION ' )
6668 ->addChild ('PRODUCTTOKEN ' , $ this ->productToken );
6769
6870 if ($ tariff = $ message ->getTariff ()) {
69- $ xml ->addChild ('TARIFF ' , $ tariff );
71+ $ xml ->addChild ('TARIFF ' , ( string ) $ tariff );
7072 }
7173
7274 $ msg = $ xml ->addChild ('MSG ' );
7375 foreach ($ message ->toXmlArray () as $ name => $ value ) {
74- $ msg ->addChild ($ name , $ value );
76+ $ msg ->addChild ($ name , ( string ) $ value );
7577 }
7678 $ msg ->addChild ('TO ' , $ recipient );
7779
0 commit comments