Issues (8)

src/SmsRuApi.php (2 issues)

1
<?php
2
3
4
namespace NotificationChannels\SmsRu;
5
6
7
class SmsRuApi extends \Zelenin\SmsRu\Api
8
{
9
    public function sendMessage($recipient, SmsRuMessage $message)
10
    {
11
        $sms = new \Zelenin\SmsRu\Entity\Sms($recipient, $message->content);
12
13
        if ($message->time) {
14
            $sms->time = $message->time;
15
        }
16
17
        if ($message->test) {
18
            $sms->test = $message->test;
0 ignored issues
show
Documentation Bug introduced by
The property $test was declared of type string, but $message->test is of type true. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
19
        }
20
21
        if ($message->from) {
22
            $sms->from = $message->from;
23
        }
24
25
        if ($message->translit) {
26
            $sms->translit = $message->translit;
0 ignored issues
show
Documentation Bug introduced by
The property $translit was declared of type string, but $message->translit is of type true. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
27
        }
28
29
        if ($message->partnerId) {
30
            $sms->partner_id = $message->partnerId;
31
        }
32
33
        return $this->smsSend($sms);
34
    }
35
}