You are here

class TwilioMedia in Twilio SMS Integration 8

Class TwilioMedia

Contains methods for working with media sent by SMS.

@package Drupal\sms_twilio\Utility

Hierarchy

Expanded class hierarchy of TwilioMedia

1 file declares its use of TwilioMedia
Twilio.php in src/Plugin/SmsGateway/Twilio.php

File

src/Utility/TwilioMedia.php, line 12

Namespace

Drupal\sms_twilio\Utility
View source
class TwilioMedia {

  /**
   * Helper function for processing attached SMS/MMS media.
   *
   * @param array $params The original payload from Twilio.
   * @return array An array of files, with url and content-type keys.
   */
  public static function processMedia(array $params) {
    $i = 0;
    $files = [];
    while ($i < $params['NumMedia']) {
      $files[] = [
        'url' => $params['MediaUrl' . $i],
        'content-type' => $params['MediaContentType' . $i],
      ];
      $i++;
    }
    return $files;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TwilioMedia::processMedia public static function Helper function for processing attached SMS/MMS media.