Merge pull request #14981 from eileenmcnaughton/load_extract
[civicrm-core.git] / api / v3 / MailingContact.php
index 174eae6b791d9daa992c267375c8e53ac5f406c2..e4d693a258a2b149582d8f5ec4c3d16f9e4e43a0 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2017                                |
+ | Copyright CiviCRM LLC (c) 2004-2019                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -75,21 +75,22 @@ function _civicrm_api3_mailing_contact_getresults($params, $count) {
  *   Array of parameters determined by getfields.
  */
 function _civicrm_api3_mailing_contact_get_spec(&$params) {
-  $params['contact_id'] = array(
+  $params['contact_id'] = [
     'api.required' => 1,
     'title' => 'Contact ID',
     'type' => CRM_Utils_Type::T_INT,
-  );
+  ];
 
-  $params['type'] = array(
+  $params['type'] = [
     'api.default' => 'Delivered',
-    'title' => 'Type', // doesn't really explain the field - but not sure I understand it to explain it better
+    // doesn't really explain the field - but not sure I understand it to explain it better
+    'title' => 'Type',
     'type' => CRM_Utils_Type::T_STRING,
-    'options' => array(
+    'options' => [
       'Delivered' => 'Delivered',
       'Bounced' => 'Bounced',
-    ),
-  );
+    ],
+  ];
 }
 
 /**
@@ -131,20 +132,20 @@ AND        meq.contact_id = %1
 GROUP BY   m.id
 ";
 
-    $qParams = array(
-      1 => array($contactID, 'Integer'),
-    );
+    $qParams = [
+      1 => [$contactID, 'Integer'],
+    ];
     $dao = CRM_Core_DAO::executeQuery($sql, $qParams);
 
     $results = $dao->N;
   }
   else {
-    $defaultFields = array(
+    $defaultFields = [
       'm.id'       => 'mailing_id',
       'm.subject'  => 'subject',
       'c.id' => 'creator_id',
       'c.sort_name' => 'creator_name',
-    );
+    ];
 
     if ($selectFields) {
       $fields = array_merge($selectFields, $defaultFields);
@@ -153,7 +154,7 @@ GROUP BY   m.id
       $fields = $defaultFields;
     }
 
-    $select = array();
+    $select = [];
     foreach ($fields as $n => $l) {
       $select[] = "$n as $l";
     }
@@ -186,14 +187,14 @@ LIMIT %2, %3
 ";
     }
 
-    $qParams = array(
-      1 => array($contactID, 'Integer'),
-      2 => array($offset, 'Integer'),
-      3 => array($limit, 'Integer'),
-    );
+    $qParams = [
+      1 => [$contactID, 'Integer'],
+      2 => [$offset, 'Integer'],
+      3 => [$limit, 'Integer'],
+    ];
     $dao = CRM_Core_DAO::executeQuery($sql, $qParams);
 
-    $results = array();
+    $results = [];
     while ($dao->fetch()) {
       foreach ($fields as $n => $l) {
         $results[$dao->mailing_id][$l] = $dao->$l;
@@ -222,7 +223,7 @@ function _civicrm_api3_mailing_contact_get_delivered(
   $sort,
   $getCount
 ) {
-  $selectFields = array('med.time_stamp' => 'start_date');
+  $selectFields = ['med.time_stamp' => 'start_date'];
 
   $fromClause = "
 INNER JOIN civicrm_mailing_event_delivered med ON med.event_queue_id = meq.id