original_string: private function buildPayload( $type, $to, $templateId, array $personalisation, $reference ){
  
          $payload = [
              'template_id'=> $templateId
          ];
  
          if ( $type == 'sms' ) {
              $payload['phone_number'] = $to;
          } else if ( $type == 'email' ) {
              $payload['email_address'] = $to;
          }
  
          if ( count($personalisation) > 0 ) {
              $payload['personalisation'] = $personalisation;
          }
  
          if ( isset($reference) && $reference != '' ) {
              $payload['reference'] = $reference;
          }
  
          return $payload;
  
      }
code: private function buildPayload( $type, $to, $templateId, array $personalisation, $reference ){
  
          $payload = [
              'template_id'=> $templateId
          ];
  
          if ( $type == 'sms' ) {
              $payload['phone_number'] = $to;
          } else if ( $type == 'email' ) {
              $payload['email_address'] = $to;
          }
  
          if ( count($personalisation) > 0 ) {
              $payload['personalisation'] = $personalisation;
          }
  
          if ( isset($reference) && $reference != '' ) {
              $payload['reference'] = $reference;
          }
  
          return $payload;
  
      }
code_tokens: private function buildPayload ( $ type , $ to , $ templateId , array $ personalisation , $ reference ) { $ payload = [ 'template_id' => $ templateId ] ; if ( $ type == 'sms' ) { $ payload [ 'phone_number' ] = $ to ; } else if ( $ type == 'email' ) { $ payload [ 'email_address' ] = $ to ; } if ( count ( $ personalisation ) > 0 ) { $ payload [ 'personalisation' ] = $ personalisation ; } if ( isset ( $ reference ) && $ reference != '' ) { $ payload [ 'reference' ] = $ reference ; } return $ payload ; }
docstring: Generates the payload expected by the API.
  
  @param string    $type
  @param string    $to
  @param string    $templateId
  @param array     $personalisation
  @param string    $reference
  
  @return array
docstring_tokens: Generates the payload expected by the API .