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')); |
||
| 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.