INFRA-132 - Trailing commas for multiline arrays
[civicrm-core.git] / CRM / Mailing / BAO / Mailing.php
index 8a237081bdbc876f7373abe42a9948183c899b61..c016b194f34c8d1e3753e1402be5b3454d199e55 100644 (file)
@@ -91,7 +91,7 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing {
   /**
    * Class constructor
    */
-  function __construct() {
+  public function __construct() {
     parent::__construct();
   }
 
@@ -102,7 +102,7 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing {
    *
    * @return int
    */
-  static function &getRecipientsCount($job_id, $mailing_id = NULL, $mode = NULL) {
+  public static function &getRecipientsCount($job_id, $mailing_id = NULL, $mode = NULL) {
     // need this for backward compatibility, so we can get count for old mailings
     // please do not use this function if possible
     $eq = self::getRecipients($job_id, $mailing_id);
@@ -112,7 +112,8 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing {
   // note that $job_id is used only as a variable in the temp table construction
   // and does not play a role in the queries generated
   /**
-   * @param int $job_id (misnomer) a nonce value used to name temporary tables
+   * @param int $job_id
+   *   (misnomer) a nonce value used to name temporary tables.
    * @param int $mailing_id
    * @param null $offset
    * @param null $limit
@@ -159,38 +160,41 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing {
     // the record that comes last that counts. That's because we are
     // INSERT'ing INTO a table with a primary id so that last record
     // over writes any previous record.
-    switch($email_selection_method) {
-    case 'location-exclude':
-      $location_filter = "($email.location_type_id != $location_type_id)";
-      // If there is more than one email that doesn't match the location,
-      // prefer the one marked is_bulkmail, followed by is_primary.
-      $order_by = "ORDER BY $email.is_bulkmail, $email.is_primary";
-      break;
-    case 'location-only':
-      $location_filter = "($email.location_type_id = $location_type_id)";
-      // If there is more than one email of the desired location, prefer
-      // the one marked is_bulkmail, followed by is_primary.
-      $order_by = "ORDER BY $email.is_bulkmail, $email.is_primary";
-      break;
-    case 'location-prefer':
-      $location_filter = "($email.is_bulkmail = 1 OR $email.is_primary = 1 OR $email.location_type_id = $location_type_id)";
-
-      // ORDER BY is more complicated because we have to set an arbitrary
-      // order that prefers the location that we want. We do that using
-      // the FIELD function. For more info, see:
-      // https://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_field
-      // We assign the location type we want the value "1" by putting it
-      // in the first position after we name the field. All other location
-      // types are left out, so they will be assigned the value 0. That
-      // means, they will all be equally tied for first place, with our
-      // location being last.
-      $order_by = "ORDER BY FIELD($email.location_type_id, $location_type_id), $email.is_bulkmail, $email.is_primary";
-      break;
-    case 'automatic':
-      // fall through to default
-    default:
-      $location_filter = "($email.is_bulkmail = 1 OR $email.is_primary = 1)";
-      $order_by = "ORDER BY $email.is_bulkmail";
+    switch ($email_selection_method) {
+      case 'location-exclude':
+        $location_filter = "($email.location_type_id != $location_type_id)";
+        // If there is more than one email that doesn't match the location,
+        // prefer the one marked is_bulkmail, followed by is_primary.
+        $order_by = "ORDER BY $email.is_bulkmail, $email.is_primary";
+        break;
+
+      case 'location-only':
+        $location_filter = "($email.location_type_id = $location_type_id)";
+        // If there is more than one email of the desired location, prefer
+        // the one marked is_bulkmail, followed by is_primary.
+        $order_by = "ORDER BY $email.is_bulkmail, $email.is_primary";
+        break;
+
+      case 'location-prefer':
+        $location_filter = "($email.is_bulkmail = 1 OR $email.is_primary = 1 OR $email.location_type_id = $location_type_id)";
+
+        // ORDER BY is more complicated because we have to set an arbitrary
+        // order that prefers the location that we want. We do that using
+        // the FIELD function. For more info, see:
+        // https://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_field
+        // We assign the location type we want the value "1" by putting it
+        // in the first position after we name the field. All other location
+        // types are left out, so they will be assigned the value 0. That
+        // means, they will all be equally tied for first place, with our
+        // location being last.
+        $order_by = "ORDER BY FIELD($email.location_type_id, $location_type_id), $email.is_bulkmail, $email.is_primary";
+        break;
+
+      case 'automatic':
+        // fall through to default
+      default:
+        $location_filter = "($email.is_bulkmail = 1 OR $email.is_primary = 1)";
+        $order_by = "ORDER BY $email.is_bulkmail";
     }
 
     /* Create a temp table for contact exclusion */
@@ -622,7 +626,6 @@ ORDER BY   i.contact_id, i.{$tempColumn}
    *
    * Returns the regex patterns that are used for preparing the text and html templates
    *
-   * @access private
    *
    **/
   private function &getPatterns($onlyHrefs = FALSE) {
@@ -654,13 +657,13 @@ ORDER BY   i.contact_id, i.{$tempColumn}
    *  returns an array that denotes the type of token that we are dealing with
    *  we use the type later on when we are doing a token replcement lookup
    *
-   *  @param string $token       The token for which we will be doing adata lookup
+   * @param string $token       The token for which we will be doing adata lookup
    *
-   *  @return array $funcStruct  An array that holds the token itself and the type.
+   * @return array $funcStruct  An array that holds the token itself and the type.
    *                             the type will tell us which function to use for the data lookup
    *                             if we need to do a lookup at all
    */
-  function &getDataFunc($token) {
+  public function &getDataFunc($token) {
     static $_categories = NULL;
     static $_categoryString = NULL;
     if (!$_categories) {
@@ -720,7 +723,6 @@ ORDER BY   i.contact_id, i.{$tempColumn}
    * for generating the emails and returns a copy of the
    * prepared templates
    *
-   * @access private
    *
    **/
   private function getPreparedTemplates() {
@@ -766,7 +768,6 @@ ORDER BY   i.contact_id, i.{$tempColumn}
    *
    *
    * @return array reference to an assoc array
-   * @access private
    *
    **/
   private function &getTemplates() {
@@ -834,7 +835,6 @@ ORDER BY   i.contact_id, i.{$tempColumn}
    *  either text or html for this to have any meaningful impact
    *
    * @return array               reference to an assoc array
-   * @access public
    *
    **/
   public function &getTokens() {
@@ -868,7 +868,6 @@ ORDER BY   i.contact_id, i.{$tempColumn}
    * hook in one call and standardizes it across other token workflows
    *
    * @return array               reference to an assoc array
-   * @access public
    *
    **/
   public function &getFlattenedTokens() {
@@ -892,8 +891,8 @@ ORDER BY   i.contact_id, i.{$tempColumn}
    *  structures to represent the order in which tokens were found from left to right, top to bottom.
    *
    *
-   * @param str $prop     name of the property that holds the text that we want to scan for tokens (html, text)
-   * @access private
+   * @param string $propName of the property that holds the text that we want to scan for tokens (html, text).
+   *   Name of the property that holds the text that we want to scan for tokens (html, text).
    *
    * @return void
    */
@@ -915,15 +914,15 @@ ORDER BY   i.contact_id, i.{$tempColumn}
   /**
    * Generate an event queue for a test job
    *
-   * @param array $testParams contains form values
+   * @param array $testParams
+   *   Contains form values.
    *
    * @return void
-   * @access public
    */
   public function getTestRecipients($testParams) {
     if (array_key_exists($testParams['test_group'], CRM_Core_PseudoConstant::group())) {
-      $contacts = civicrm_api('contact','get', array(
-        'version' =>3,
+      $contacts = civicrm_api('contact', 'get', array(
+        'version' => 3,
         'group' => $testParams['test_group'],
          'return' => 'id',
            'options' => array('limit' => 100000000000,
@@ -965,7 +964,6 @@ ORDER BY   civicrm_email.is_bulkmail DESC
    * @param void
    *
    * @return void
-   * @access private
    */
   private function getHeaderFooter() {
     if (!$this->header and $this->header_id) {
@@ -993,16 +991,21 @@ ORDER BY   civicrm_email.is_bulkmail DESC
    * is placed on the values received, so they do not need to follow the verp
    * convention.
    *
-   * @param array  $headers         Array of message headers to update, in-out
-   * @param string $prefix          Prefix for the message ID, use same prefixes as verp
+   * @param array $headers
+   *   Array of message headers to update, in-out.
+   * @param string $prefix
+   *   Prefix for the message ID, use same prefixes as verp.
    *                                wherever possible
-   * @param string $job_id          Job ID component of the generated message ID
-   * @param string $event_queue_id  Event Queue ID component of the generated message ID
-   * @param string $hash            Hash component of the generated message ID.
+   * @param string $job_id
+   *   Job ID component of the generated message ID.
+   * @param string $event_queue_id
+   *   Event Queue ID component of the generated message ID.
+   * @param string $hash
+   *   Hash component of the generated message ID.
    *
    * @return void
    */
-  static function addMessageIdHeader(&$headers, $prefix, $job_id, $event_queue_id, $hash) {
+  public static function addMessageIdHeader(&$headers, $prefix, $job_id, $event_queue_id, $hash) {
     $config           = CRM_Core_Config::singleton();
     $localpart        = CRM_Core_BAO_MailSettings::defaultLocalpart();
     $emailDomain      = CRM_Core_BAO_MailSettings::defaultDomain();
@@ -1023,14 +1026,18 @@ ORDER BY   civicrm_email.is_bulkmail DESC
   /**
    * Static wrapper for getting verp and urls
    *
-   * @param int $job_id ID of the Job associated with this message
-   * @param int $event_queue_id ID of the EventQueue
-   * @param string $hash Hash of the EventQueue
-   * @param string $email Destination address
+   * @param int $job_id
+   *   ID of the Job associated with this message.
+   * @param int $event_queue_id
+   *   ID of the EventQueue.
+   * @param string $hash
+   *   Hash of the EventQueue.
+   * @param string $email
+   *   Destination address.
    *
    * @return array (reference) array    array ref that hold array refs to the verp info and urls
    */
-  static function getVerpAndUrls($job_id, $event_queue_id, $hash, $email) {
+  public static function getVerpAndUrls($job_id, $event_queue_id, $hash, $email) {
     // create a skeleton object and set its properties that are required by getVerpAndUrlsAndHeaders()
     $config         = CRM_Core_Config::singleton();
     $bao            = new CRM_Mailing_BAO_Mailing();
@@ -1045,10 +1052,14 @@ ORDER BY   civicrm_email.is_bulkmail DESC
   /**
    * Get verp, urls and headers
    *
-   * @param int $job_id ID of the Job associated with this message
-   * @param int $event_queue_id ID of the EventQueue
-   * @param string $hash Hash of the EventQueue
-   * @param string $email Destination address
+   * @param int $job_id
+   *   ID of the Job associated with this message.
+   * @param int $event_queue_id
+   *   ID of the EventQueue.
+   * @param string $hash
+   *   Hash of the EventQueue.
+   * @param string $email
+   *   Destination address.
    *
    * @param bool $isForward
    *
@@ -1137,24 +1148,33 @@ ORDER BY   civicrm_email.is_bulkmail DESC
   /**
    * Compose a message
    *
-   * @param int $job_id ID of the Job associated with this message
-   * @param int $event_queue_id ID of the EventQueue
-   * @param string $hash Hash of the EventQueue
-   * @param string $contactId ID of the Contact
-   * @param string $email Destination address
-   * @param string $recipient To: of the recipient
-   * @param boolean $test Is this mailing a test?
+   * @param int $job_id
+   *   ID of the Job associated with this message.
+   * @param int $event_queue_id
+   *   ID of the EventQueue.
+   * @param string $hash
+   *   Hash of the EventQueue.
+   * @param string $contactId
+   *   ID of the Contact.
+   * @param string $email
+   *   Destination address.
+   * @param string $recipient
+   *   To: of the recipient.
+   * @param bool $test
+   *   Is this mailing a test?.
    * @param $contactDetails
    * @param $attachments
-   * @param boolean $isForward Is this mailing compose for forward?
-   * @param string $fromEmail email address of who is forwardinf it.
+   * @param bool $isForward
+   *   Is this mailing compose for forward?.
+   * @param string $fromEmail
+   *   Email address of who is forwardinf it.
    *
    * @param null $replyToEmail
    *
    * @return Mail_mime               The mail object
-   * @access public
    */
-  public function &compose($job_id, $event_queue_id, $hash, $contactId,
+  public function &compose(
+    $job_id, $event_queue_id, $hash, $contactId,
     $email, &$recipient, $test,
     $contactDetails, &$attachments, $isForward = FALSE,
     $fromEmail = NULL, $replyToEmail = NULL
@@ -1482,7 +1502,6 @@ ORDER BY   civicrm_email.is_bulkmail DESC
    * prior-mailing targets.
    *
    * @return array        Names of groups receiving this mailing
-   * @access public
    */
   public function &getGroupNames() {
     if (!isset($this->id)) {
@@ -1510,15 +1529,16 @@ ORDER BY   civicrm_email.is_bulkmail DESC
   /**
    * Add the mailings
    *
-   * @param array $params reference array contains the values submitted by the form
-   * @param array $ids    reference array contains the id
+   * @param array $params
+   *   Reference array contains the values submitted by the form.
+   * @param array $ids
+   *   Reference array contains the id.
    *
-   * @access public
    * @static
    *
    * @return object
    */
-  static function add(&$params, $ids = array()) {
+  public static function add(&$params, $ids = array()) {
     $id = CRM_Utils_Array::value('mailing_id', $ids, CRM_Utils_Array::value('id', $params));
 
     if ($id) {
@@ -1556,13 +1576,13 @@ ORDER BY   civicrm_email.is_bulkmail DESC
    * Construct a new mailing object, along with job and mailing_group
    * objects, from the form values of the create mailing wizard.
    *
-   * @params array $params        Form values
+   * @params array $params
+   *   Form values.
    *
    * @param array $params
    * @param array $ids
    *
    * @return object $mailing      The new mailing object
-   * @access public
    * @static
    */
   public static function create(&$params, $ids = array()) {
@@ -1687,7 +1707,7 @@ ORDER BY   civicrm_email.is_bulkmail DESC
       $job->status = 'Scheduled';
       $job->is_test = 0;
 
-      if ( !$job->find(TRUE) ) {
+      if (!$job->find(TRUE)) {
         $job->scheduled_date = $params['scheduled_date'];
         $job->save();
       }
@@ -1705,8 +1725,10 @@ ORDER BY   civicrm_email.is_bulkmail DESC
    * Replace the list of recipients on a given mailing
    *
    * @param int $mailingId
-   * @param string $type 'include' or 'exclude'
-   * @param string $entity 'groups' or 'mailings'
+   * @param string $type
+   *   'include' or 'exclude'.
+   * @param string $entity
+   *   'groups' or 'mailings'.
    * @param array<int> $entityIds
    * @throws CiviCRM_API3_Exception
    */
@@ -1716,7 +1738,7 @@ ORDER BY   civicrm_email.is_bulkmail DESC
       $values[] = array('entity_id' => $entityId);
     }
     civicrm_api3('mailing_group', 'replace', array(
-      'mailing_id' =>  $mailingId,
+      'mailing_id' => $mailingId,
       'group_type' => $type,
       'entity_table' => ($entity == 'groups') ? CRM_Contact_BAO_Group::getTableName() : CRM_Mailing_BAO_Mailing::getTableName(),
       'values' => $values,
@@ -1738,13 +1760,14 @@ ORDER BY   civicrm_email.is_bulkmail DESC
    * Generate a report.  Fetch event count information, mailing data, and job
    * status.
    *
-   * @param int $id The mailing id to report
-   * @param boolean $skipDetails whether return all detailed report
+   * @param int $id
+   *   The mailing id to report.
+   * @param bool $skipDetails
+   *   Whether return all detailed report.
    *
    * @param bool $isSMS
    *
    * @return array        Associative array of reporting data
-   * @access public
    * @static
    */
   public static function &report($id, $skipDetails = FALSE, $isSMS = FALSE) {
@@ -1771,7 +1794,6 @@ ORDER BY   civicrm_email.is_bulkmail DESC
       'spool' => CRM_Mailing_BAO_Spool::getTableName(),
     );
 
-
     $report = array();
     $additionalWhereClause = " AND ";
     if (!$isSMS) {
@@ -2132,7 +2154,6 @@ ORDER BY   civicrm_email.is_bulkmail DESC
       ),
     );
 
-
     $actionLinks = array(CRM_Core_Action::VIEW => array('name' => ts('Report')));
     if (CRM_Core_Permission::check('view all contacts')) {
       $actionLinks[CRM_Core_Action::ADVANCED] =
@@ -2218,7 +2239,6 @@ ORDER BY   civicrm_email.is_bulkmail DESC
    * @param
    *
    * @return int              Count
-   * @access public
    */
   public function getCount() {
     $this->selectAdd();
@@ -2235,7 +2255,7 @@ ORDER BY   civicrm_email.is_bulkmail DESC
    *
    * @throws Exception
    */
-  static function checkPermission($id) {
+  public static function checkPermission($id) {
     if (!$id) {
       return;
     }
@@ -2256,7 +2276,7 @@ ORDER BY   civicrm_email.is_bulkmail DESC
    *
    * @return string
    */
-  static function mailingACL($alias = NULL) {
+  public static function mailingACL($alias = NULL) {
     $mailingACL = " ( 0 ) ";
 
     $mailingIDs = self::mailingACLIDs();
@@ -2282,7 +2302,7 @@ ORDER BY   civicrm_email.is_bulkmail DESC
    * @return boolean | array - TRUE if the user has access to all mailings, else array of mailing IDs (possibly empty)
    * @static
    */
-  static function mailingACLIDs() {
+  public static function mailingACLIDs() {
     // CRM-11633
     // optimize common case where admin has access
     // to all mailings
@@ -2323,15 +2343,17 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id   = m.id
   /**
    * Get the rows for a browse operation
    *
-   * @param int $offset The row number to start from
-   * @param int $rowCount The nmber of rows to return
-   * @param string $sort The sql string that describes the sort order
+   * @param int $offset
+   *   The row number to start from.
+   * @param int $rowCount
+   *   The nmber of rows to return.
+   * @param string $sort
+   *   The sql string that describes the sort order.
    *
    * @param null $additionalClause
    * @param array $additionalParams
    *
    * @return array            The rows
-   * @access public
    */
   public function &getRows($offset, $rowCount, $sort, $additionalClause = NULL, $additionalParams = NULL) {
     $mailing = self::getTableName();
@@ -2421,19 +2443,18 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id   = m.id
    *
    * @return string
    * @static
-   * @access public
    */
-  static function showEmailDetails($id) {
+  public static function showEmailDetails($id) {
     return CRM_Utils_System::url('civicrm/mailing/report', "mid=$id");
   }
 
   /**
    * Delete Mails and all its associated records
    *
-   * @param  int  $id id of the mail to delete
+   * @param int $id
+   *   Id of the mail to delete.
    *
    * @return void
-   * @access public
    * @static
    */
   public static function del($id) {
@@ -2461,10 +2482,10 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id   = m.id
    * Delete Jobss and all its associated records
    * related to test Mailings
    *
-   * @param  int  $id id of the Job to delete
+   * @param int $id
+   *   Id of the Job to delete.
    *
    * @return void
-   * @access public
    * @static
    */
   public static function delJob($id) {
@@ -2480,7 +2501,7 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id   = m.id
   /**
    * @return array
    */
-  function getReturnProperties() {
+  public function getReturnProperties() {
     $tokens = &$this->getTokens();
 
     $properties = array();
@@ -2518,7 +2539,6 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id   = m.id
    * @param CRM_Core_Form $form
    *
    * @return void
-   * @access public
    */
   public static function commonCompose(&$form) {
     //get the tokens.
@@ -2551,7 +2571,8 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id   = m.id
       $form->addWysiwyg('html_message',
         ts('HTML Format'),
         array(
-          'cols' => '80', 'rows' => '8',
+          'cols' => '80',
+      'rows' => '8',
           'onkeyup' => "return verify(this)",
         )
       );
@@ -2574,7 +2595,8 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id   = m.id
       }
       $form->add('textarea', $id, $label,
         array(
-          'cols' => '80', 'rows' => '8',
+          'cols' => '80',
+      'rows' => '8',
           'onkeyup' => "return verify(this, '{$prefix}')",
         )
       );
@@ -2611,7 +2633,6 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id   = m.id
    * @param CRM_Core_Form $form
    *
    * @return void
-   * @access public
    */
   public static function commonLetterCompose(&$form) {
     //get the tokens.
@@ -2624,7 +2645,7 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id   = m.id
       $tokens = array_merge(CRM_Core_SelectValues::contributionTokens(), $tokens);
     }
 
-    if(method_exists($form, 'listTokens')) {
+    if (method_exists($form, 'listTokens')) {
       $tokens = array_merge($form->listTokens(), $tokens);
     }
 
@@ -2646,11 +2667,11 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id   = m.id
     );
     $form->add('text', 'saveTemplateName', ts('Template Title'));
 
-
     $form->addWysiwyg('html_message',
       ts('Your Letter'),
       array(
-        'cols' => '80', 'rows' => '8',
+        'cols' => '80',
+    'rows' => '8',
         'onkeyup' => "return verify(this)",
       )
     );
@@ -2666,7 +2687,6 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id   = m.id
    * Get the search based mailing Ids
    *
    * @return array $mailingIDs, searched base mailing ids.
-   * @access public
    */
   public function searchMailingIDs() {
     $group = CRM_Mailing_DAO_MailingGroup::getTableName();
@@ -2690,15 +2710,17 @@ SELECT  $mailing.id as mailing_id
   /**
    * Get the content/components of mailing based on mailing Id
    *
-   * @param $report array of mailing report
+   * @param $report
+   *   Array of mailing report.
    *
-   * @param $form reference of this
+   * @param $form
+   *   Reference of this.
    *
    * @param bool $isSMS
    *
    * @return array $report array content/component.@access public
    */
-  static function getMailingContent(&$report, &$form, $isSMS = FALSE) {
+  public static function getMailingContent(&$report, &$form, $isSMS = FALSE) {
     $htmlHeader = $textHeader = NULL;
     $htmlFooter = $textFooter = NULL;
 
@@ -2750,7 +2772,7 @@ SELECT  $mailing.id as mailing_id
    *
    * @return mixed
    */
-  static function overrideVerp($jobID) {
+  public static function overrideVerp($jobID) {
     static $_cache = array();
 
     if (!isset($_cache[$jobID])) {
@@ -2772,7 +2794,7 @@ WHERE  civicrm_mailing_job.id = %1
    * @return bool
    * @throws Exception
    */
-  static function processQueue($mode = NULL) {
+  public static function processQueue($mode = NULL) {
     $config = &CRM_Core_Config::singleton();
 
     if ($mode == NULL && CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG") {
@@ -2847,7 +2869,7 @@ AND    e.id NOT IN ( SELECT email_id FROM civicrm_mailing_recipients mr WHERE ma
    *
    * @return mixed
    */
-  static function getMailingsList($isSMS = FALSE) {
+  public static function getMailingsList($isSMS = FALSE) {
     static $list = array();
     $where = " WHERE ";
     if (!$isSMS) {
@@ -2878,7 +2900,7 @@ ORDER BY civicrm_mailing.name";
    *
    * @return null|string
    */
-  static function hiddenMailingGroup($mid) {
+  public static function hiddenMailingGroup($mid) {
     $sql = "
 SELECT     g.id
 FROM       civicrm_mailing m
@@ -2888,17 +2910,17 @@ WHERE      g.is_hidden = 1
 AND        mg.group_type = 'Include'
 AND        m.id = %1
 ";
-    $params = array( 1 => array( $mid, 'Integer' ) );
+    $params = array(1 => array($mid, 'Integer'));
     return CRM_Core_DAO::singleValueQuery($sql, $params);
   }
 
   /**
    * This function is a wrapper for ajax activity selector
    *
-   * @param  array   $params associated array for params record id.
+   * @param array $params
+   *   Associated array for params record id.
    *
    * @return array   $contactActivities associated array of contact activities
-   * @access public
    */
   public static function getContactMailingSelector(&$params) {
     // format the params
@@ -2933,9 +2955,9 @@ AND        m.id = %1
         "reset=1&cid={$values['creator_id']}");
 
       //CRM-12814
-      $contactMailings[$mailingId]['openstats'] = "Opens: ".
-        CRM_Utils_Array::value($values['mailing_id'], $openCounts, 0).
-        "<br />Clicks: ".
+      $contactMailings[$mailingId]['openstats'] = "Opens: " .
+        CRM_Utils_Array::value($values['mailing_id'], $openCounts, 0) .
+        "<br />Clicks: " .
         CRM_Utils_Array::value($values['mailing_id'], $clickCounts, 0);
 
       $actionLinks = array(
@@ -2951,7 +2973,7 @@ AND        m.id = %1
           'url' => 'civicrm/mailing/report',
           'qs' => "mid=%%mid%%&reset=1&cid=%%cid%%&context=mailing",
           'title' => ts('View Mailing Report'),
-        )
+        ),
       );
 
       $mailingKey = $values['mailing_id'];
@@ -2961,7 +2983,7 @@ AND        m.id = %1
 
       $contactMailings[$mailingId]['links'] = CRM_Core_Action::formLink(
         $actionLinks,
-        null,
+        NULL,
         array(
           'mid' => $values['mailing_id'],
           'cid' => $params['contact_id'],
@@ -2981,12 +3003,12 @@ AND        m.id = %1
   /**
    * Retrieve contact mailing
    *
-   * @param array $params associated array
+   * @param array $params
+   *   Associated array.
    *
    * @return array of mailings for a contact
    *
    * @static
-   * @access public
    */
   static public function getContactMailings(&$params) {
     $params['version'] = 3;
@@ -3001,12 +3023,12 @@ AND        m.id = %1
   /**
    * Retrieve contact mailing count
    *
-   * @param array $params associated array
+   * @param array $params
+   *   Associated array.
    *
    * @return int count of mailings for a contact
    *
    * @static
-   * @access public
    */
   static public function getContactMailingsCount(&$params) {
     $params['version'] = 3;