INFRA-132 - phpcbf Drupal.WhiteSpace.ScopeIndent.IncorrectExact
[civicrm-core.git] / CRM / Mailing / Event / BAO / TrackableURLOpen.php
index d09de002523cb799f02515cbcf1e6205133ad4e1..dcadfa6bd5d7063af6906d0c4c6cacf039a556ae 100755 (executable)
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -45,22 +45,23 @@ class CRM_Mailing_Event_BAO_TrackableURLOpen extends CRM_Mailing_Event_DAO_Track
    * Track a click-through and return the URL to redirect.  If the numbers
    * don't match up, return the base url.
    *
-   * @param int $queue_id     The Queue Event ID of the clicker
-   * @param int $url_id       The ID of the trackable URL
+   * @param int $queue_id
+   *   The Queue Event ID of the clicker.
+   * @param int $url_id
+   *   The ID of the trackable URL.
    *
-   * @return string $url      The redirection url, or base url on failure.
-   * @static
+   * @return string
+   *   The redirection url, or base url on failure.
    */
   public static function track($queue_id, $url_id) {
 
     $search = new CRM_Mailing_BAO_TrackableURL();
 
     /* To find the url, we also join on the queue and job tables.  This
-         * prevents foreign key violations. */
-
+     * prevents foreign key violations. */
 
-    $job  = CRM_Mailing_BAO_MailingJob::getTableName();
-    $eq   = CRM_Mailing_Event_BAO_Queue::getTableName();
+    $job = CRM_Mailing_BAO_MailingJob::getTableName();
+    $eq = CRM_Mailing_Event_BAO_Queue::getTableName();
     $turl = CRM_Mailing_BAO_TrackableURL::getTableName();
 
     if (!$queue_id) {
@@ -97,23 +98,28 @@ class CRM_Mailing_Event_BAO_TrackableURLOpen extends CRM_Mailing_Event_DAO_Track
   /**
    * Get row count for the event selector
    *
-   * @param int $mailing_id       ID of the mailing
-   * @param int $job_id           Optional ID of a job to filter on
-   * @param boolean $is_distinct  Group by queue ID?
-   * @param int $url_id           Optional ID of a url to filter on
+   * @param int $mailing_id
+   *   ID of the mailing.
+   * @param int $job_id
+   *   Optional ID of a job to filter on.
+   * @param bool $is_distinct
+   *   Group by queue ID?.
+   * @param int $url_id
+   *   Optional ID of a url to filter on.
    *
-   * @return int                  Number of rows in result set
-   * @static
+   * @return int
+   *   Number of rows in result set
    */
-  public static function getTotalCount($mailing_id, $job_id = NULL,
+  public static function getTotalCount(
+    $mailing_id, $job_id = NULL,
     $is_distinct = FALSE, $url_id = NULL, $toDate = NULL
   ) {
     $dao = new CRM_Core_DAO();
 
-    $click   = self::getTableName();
-    $queue   = CRM_Mailing_Event_BAO_Queue::getTableName();
+    $click = self::getTableName();
+    $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
     $mailing = CRM_Mailing_BAO_Mailing::getTableName();
-    $job     = CRM_Mailing_BAO_MailingJob::getTableName();
+    $job = CRM_Mailing_BAO_MailingJob::getTableName();
 
     $query = "
             SELECT      COUNT($click.id) as opened
@@ -159,8 +165,8 @@ class CRM_Mailing_Event_BAO_TrackableURLOpen extends CRM_Mailing_Event_DAO_Track
    *
    * @param $mailingIDs
    *
-   * @return array          trackable url count per mailing ID
-   * @static
+   * @return array
+   *   trackable url count per mailing ID
    */
   public static function getMailingTotalCount($mailingIDs) {
     $dao = new CRM_Core_DAO();
@@ -185,7 +191,7 @@ class CRM_Mailing_Event_BAO_TrackableURLOpen extends CRM_Mailing_Event_DAO_Track
 
     $dao->query($query);
 
-    while ( $dao->fetch() ) {
+    while ($dao->fetch()) {
       $clickCount[$dao->mailingID] = $dao->opened;
     }
     return $clickCount;
@@ -194,11 +200,13 @@ class CRM_Mailing_Event_BAO_TrackableURLOpen extends CRM_Mailing_Event_DAO_Track
   /**
    * Get tracked url count for each mailing for a given set of mailing IDs
    *
-   * @param int $mailingIDs    IDs of the mailing (comma separated)
-   * @param int $contactID     ID of the contact
+   * @param int $mailingIDs
+   *   IDs of the mailing (comma separated).
+   * @param int $contactID
+   *   ID of the contact.
    *
-   * @return array             Count per mailing ID
-   * @static
+   * @return array
+   *   Count per mailing ID
    */
   public static function getMailingContactCount($mailingIDs, $contactID) {
     $dao = new CRM_Core_DAO();
@@ -224,7 +232,7 @@ class CRM_Mailing_Event_BAO_TrackableURLOpen extends CRM_Mailing_Event_DAO_Track
 
     $dao->query($query);
 
-    while ( $dao->fetch() ) {
+    while ($dao->fetch()) {
       $clickCount[$dao->mailingID] = $dao->opened;
     }
 
@@ -234,32 +242,41 @@ class CRM_Mailing_Event_BAO_TrackableURLOpen extends CRM_Mailing_Event_DAO_Track
   /**
    * Get rows for the event browser
    *
-   * @param int $mailing_id       ID of the mailing
-   * @param int $job_id           optional ID of the job
-   * @param boolean $is_distinct  Group by queue id?
-   * @param int $url_id           optional ID of a trackable URL to filter on
-   * @param int $offset           Offset
-   * @param int $rowCount         Number of rows
-   * @param array $sort           sort array
-   * @param int $contact_id       optional contact ID
+   * @param int $mailing_id
+   *   ID of the mailing.
+   * @param int $job_id
+   *   Optional ID of the job.
+   * @param bool $is_distinct
+   *   Group by queue id?.
+   * @param int $url_id
+   *   Optional ID of a trackable URL to filter on.
+   * @param int $offset
+   *   Offset.
+   * @param int $rowCount
+   *   Number of rows.
+   * @param array $sort
+   *   Sort array.
+   * @param int $contact_id
+   *   Optional contact ID.
    *
-   * @return array                Result set
-   * @static
+   * @return array
+   *   Result set
    */
-  public static function &getRows($mailing_id, $job_id = NULL,
+  public static function &getRows(
+    $mailing_id, $job_id = NULL,
     $is_distinct = FALSE, $url_id,
     $offset = NULL, $rowCount = NULL, $sort = NULL, $contact_id = NULL
   ) {
 
     $dao = new CRM_Core_Dao();
 
-    $click   = self::getTableName();
-    $url     = CRM_Mailing_BAO_TrackableURL::getTableName();
-    $queue   = CRM_Mailing_Event_BAO_Queue::getTableName();
+    $click = self::getTableName();
+    $url = CRM_Mailing_BAO_TrackableURL::getTableName();
+    $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
     $mailing = CRM_Mailing_BAO_Mailing::getTableName();
-    $job     = CRM_Mailing_BAO_MailingJob::getTableName();
+    $job = CRM_Mailing_BAO_MailingJob::getTableName();
     $contact = CRM_Contact_BAO_Contact::getTableName();
-    $email   = CRM_Core_BAO_Email::getTableName();
+    $email = CRM_Core_BAO_Email::getTableName();
 
     $query = "
             SELECT      $contact.display_name as display_name,
@@ -334,4 +351,5 @@ class CRM_Mailing_Event_BAO_TrackableURLOpen extends CRM_Mailing_Event_DAO_Track
     }
     return $results;
   }
+
 }