CRM-15905 fix - API: problem sorting contacts on ID
[civicrm-core.git] / api / v3 / MailingAB.php
index d230f203c63b54aec2aecac5c7b0e7398efe3add..8685246a110a27da077123c78adce0bfcec4f559 100755 (executable)
@@ -1,5 +1,4 @@
 <?php
-
 /*
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
@@ -24,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  * @subpackage API_MailingAB
  * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
- *
- */
-
-/**
- * Files required for this package
  */
 
 /**
- * Handle a create mailing ab testing
+ * Handle a create mailing ab testing.
  *
  * @param array $params
- * @param array $ids
  *
- * @return array API Success Array
+ * @return array
+ *   API Success Array
  */
 function civicrm_api3_mailing_a_b_create($params) {
   return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -57,9 +51,9 @@ function civicrm_api3_mailing_a_b_create($params) {
  * Handle a delete event.
  *
  * @param array $params
- * @param array $ids
  *
- * @return array API Success Array
+ * @return array
+ *   API Success Array
  */
 function civicrm_api3_mailing_a_b_delete($params) {
   return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -69,6 +63,7 @@ function civicrm_api3_mailing_a_b_delete($params) {
  * Handle a get event.
  *
  * @param array $params
+ *
  * @return array
  */
 function civicrm_api3_mailing_a_b_get($params) {
@@ -76,9 +71,10 @@ function civicrm_api3_mailing_a_b_get($params) {
 }
 
 /**
- * Adjust Metadata for submit action
+ * Adjust Metadata for submit action.
+ *
+ * The metadata is used for setting defaults, documentation & validation.
  *
- * The metadata is used for setting defaults, documentation & validation
  * @param array $params
  *   Array or parameters determined by getfields.
  */
@@ -97,9 +93,10 @@ function _civicrm_api3_mailing_a_b_submit_spec(&$params) {
 }
 
 /**
- * Send A/B mail to A/B recipients respectively
+ * Send A/B mail to A/B recipients respectively.
  *
  * @param array $params
+ *
  * @return array
  * @throws API_Exception
  */
@@ -166,9 +163,10 @@ function civicrm_api3_mailing_a_b_submit($params) {
 }
 
 /**
- * Adjust Metadata for graph_stats action
+ * Adjust Metadata for graph_stats action.
+ *
+ * The metadata is used for setting defaults, documentation & validation.
  *
- * The metadata is used for setting defaults, documentation & validation
  * @param array $params
  *   Array or parameters determined by getfields.
  */
@@ -186,9 +184,10 @@ function _civicrm_api3_mailing_a_b_graph_stats_spec(&$params) {
 }
 
 /**
- * Send graph detail for A/B tests mail
+ * Send graph detail for A/B tests mail.
  *
  * @param array $params
+ *
  * @return array
  * @throws API_Exception
  */
@@ -223,10 +222,11 @@ function civicrm_api3_mailing_a_b_graph_stats($params) {
         $graphStats[$name] = array(
           $params['split_count_select'] => array(
             'count' => CRM_Mailing_Event_BAO_Opened::getTotalCount($mailingAB[$column], NULL, TRUE, $toDate),
-            'time' => CRM_Utils_Date::customFormat($toDate)
-          )
+            'time' => CRM_Utils_Date::customFormat($toDate),
+          ),
         );
         break;
+
       case 'total unique clicks':
         $result = CRM_Mailing_Event_BAO_TrackableURLOpen::getRows($mailingAB['mailing_id_a'], NULL, TRUE, 0, 1, "civicrm_mailing_event_trackable_url_open.time_stamp ASC");
         $startDate = CRM_Utils_Date::processDate($result[0]['date']);
@@ -237,10 +237,11 @@ function civicrm_api3_mailing_a_b_graph_stats($params) {
         $graphStats[$name] = array(
           $params['split_count_select'] => array(
             'count' => CRM_Mailing_Event_BAO_TrackableURLOpen::getTotalCount($params['mailing_id'], NULL, FALSE, NULL, $toDate),
-            'time' => CRM_Utils_Date::customFormat($toDate)
-          )
+            'time' => CRM_Utils_Date::customFormat($toDate),
+          ),
         );
         break;
+
       case 'total clicks on a particular link':
         if (empty($params['target_url'])) {
           throw new API_Exception("Provide url to get stats result for total clicks on a particular link");
@@ -256,8 +257,8 @@ function civicrm_api3_mailing_a_b_graph_stats($params) {
         $graphStats[$name] = array(
           $params['split_count_select'] => array(
             'count' => CRM_Mailing_Event_BAO_TrackableURLOpen::getTotalCount($params['mailing_id'], NULL, FALSE, $url_id, $toDate),
-            'time' => CRM_Utils_Date::customFormat($toDate)
-          )
+            'time' => CRM_Utils_Date::customFormat($toDate),
+          ),
         );
         break;
     }