You are here

public function SmsIncomingController::processIncoming in SMS Framework 8

Same name and namespace in other branches
  1. 2.x src/SmsIncomingController.php \Drupal\sms\SmsIncomingController::processIncoming()
  2. 2.1.x src/SmsIncomingController.php \Drupal\sms\SmsIncomingController::processIncoming()

Receives incoming messages for a gateway.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The current HTTP request.

\Drupal\sms\Entity\SmsGatewayInterface $sms_gateway: The gateway which is handling the the incoming request.

Return value

mixed A response to return.

File

src/SmsIncomingController.php, line 65

Class

SmsIncomingController
Provides a controller for receiving incoming messages.

Namespace

Drupal\sms

Code

public function processIncoming(Request $request, SmsGatewayInterface $sms_gateway) {
  $controller = [
    $sms_gateway
      ->getPlugin(),
    'processIncoming',
  ];
  $arguments = $this->controllerResolver
    ->getArguments($request, $controller);

  /** @var \Drupal\sms\SmsProcessingResponse $response */
  $response = call_user_func_array($controller, $arguments);
  foreach ($response
    ->getMessages() as $message) {
    $this->smsProvider
      ->queue($message);
  }
  return $response
    ->getResponse();
}