tarfin-labs /
netgsm
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace TarfinLabs\Netgsm; |
||||
| 4 | |||||
| 5 | use Exception; |
||||
| 6 | use GuzzleHttp\Exception\GuzzleException; |
||||
| 7 | use Illuminate\Notifications\Notification; |
||||
| 8 | use TarfinLabs\Netgsm\Exceptions\IncorrectPhoneNumberFormatException; |
||||
| 9 | use TarfinLabs\Netgsm\Sms\AbstractNetgsmMessage; |
||||
| 10 | |||||
| 11 | class NetgsmChannel |
||||
| 12 | { |
||||
| 13 | protected $netgsm; |
||||
| 14 | |||||
| 15 | public function __construct(Netgsm $netgsm) |
||||
| 16 | { |
||||
| 17 | $this->netgsm = $netgsm; |
||||
| 18 | } |
||||
| 19 | |||||
| 20 | /** |
||||
| 21 | * Send the given notification. |
||||
| 22 | * |
||||
| 23 | * @param $notifiable |
||||
| 24 | * @param Notification $notification |
||||
| 25 | * @throws Exceptions\CouldNotSendNotification |
||||
| 26 | * @throws GuzzleException |
||||
| 27 | * @throws IncorrectPhoneNumberFormatException |
||||
| 28 | * @throws Exception |
||||
| 29 | */ |
||||
| 30 | public function send($notifiable, Notification $notification) |
||||
| 31 | { |
||||
| 32 | $message = $notification->toNetgsm($notifiable); |
||||
|
0 ignored issues
–
show
|
|||||
| 33 | |||||
| 34 | if (! $message instanceof AbstractNetgsmMessage) { |
||||
| 35 | throw new Exception(trans('netgsm::errors.invalid_netgsm_message')); |
||||
|
0 ignored issues
–
show
It seems like
trans('netgsm::errors.invalid_netgsm_message') can also be of type array and array; however, parameter $message of Exception::__construct() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 36 | } |
||||
| 37 | |||||
| 38 | if (! $message->getRecipients()) { |
||||
| 39 | $phone = $notifiable->routeNotificationFor('Netgsm'); |
||||
| 40 | $message->setRecipients($phone); |
||||
| 41 | } |
||||
| 42 | |||||
| 43 | $this->netgsm->sendSms($message); |
||||
| 44 | } |
||||
| 45 | } |
||||
| 46 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.