You are here

function KalturaNotificationClient::KalturaNotificationClient in Kaltura 5

Same name and namespace in other branches
  1. 6.2 kaltura_client/kaltura_notification_client.php \KalturaNotificationClient::KalturaNotificationClient()
  2. 6 kaltura_client/kaltura_notification_client.php \KalturaNotificationClient::KalturaNotificationClient()
  3. 7.3 kaltura_client/kaltura_notification_client.php \KalturaNotificationClient::KalturaNotificationClient()
  4. 7.2 kaltura_client/kaltura_notification_client.php \KalturaNotificationClient::KalturaNotificationClient()

File

kaltura_client/kaltura_notification_client.php, line 12

Class

KalturaNotificationClient

Code

function KalturaNotificationClient($notification_params = array(), $admin_secret = null, $validate_sig = true) {
  if (!count($notification_params)) {
    return $this;
  }
  if ($validate_sig) {
    $this
      ->validate_signature($notification_params, $admin_secret);
    if (!$this->valid_signature) {
      return $this;
    }
  }
  $this->id = $notification_params['notification_id'];
  $this->type = $notification_params['notification_type'];
  $this->puser = $notification_params['puser_id'];
  $this->partner = $notification_params['partner_id'];
  $data = array();
  foreach ($notification_params as $k => $v) {
    switch ($k) {
      case 'partner_id':
        break;
      default:
        $data[$k] = $v;
    }
  }
  if (isset($data["multi_notification"]) && $data["multi_notification"] === "true") {
    $this->multi = true;
    $res = $this
      ->splitMultiNotifications($data);
  }
  else {
    $res[0] = $data;
  }
  $this->data = $res;
  return $this;
}