INFRA-132 - Docblock @param and @return tag fixes
[civicrm-core.git] / CRM / Campaign / BAO / Survey.php
index 682945e88efca49a7a4595e080de1090a93cf274..888a96cc278e0969a0afc1926c2a51c7dbd5e2a5 100644 (file)
@@ -48,7 +48,6 @@ class CRM_Campaign_BAO_Survey extends CRM_Campaign_DAO_Survey {
    *   (reference ) an assoc array of name/value pairs.
    * @param array $defaults
    *   (reference ) an assoc array to hold the flattened values.
-   *
    */
 
   /**
@@ -218,8 +217,16 @@ SELECT  survey.id                         as id,
 
     $surveys = array();
     $properties = array(
-      'id', 'title', 'campaign_id', 'is_active', 'is_default', 'result_id', 'activity_type_id',
-      'release_frequency', 'max_number_of_contacts', 'default_number_of_contacts',
+      'id',
+      'title',
+      'campaign_id',
+      'is_active',
+      'is_default',
+      'result_id',
+      'activity_type_id',
+      'release_frequency',
+      'max_number_of_contacts',
+      'default_number_of_contacts',
     );
 
     $survey = CRM_Core_DAO::executeQuery($query, $queryParams);
@@ -341,8 +348,8 @@ SELECT  survey.id    as id,
   /**
    * Get Surveys custom groups
    *
-   * @param $surveyTypes
-   *   Array an array of survey type id.
+   * @param array $surveyTypes
+   *   an array of survey type id.
    *
    * @return array
    * @static
@@ -387,7 +394,8 @@ SELECT  survey.id    as id,
    * @param bool $is_active
    *   Value we want to set the is_active field.
    *
-   * @return Object             DAO object on sucess, null otherwise
+   * @return Object
+   *   DAO object on sucess, null otherwise
    * @static
    */
   public static function setIsActive($id, $is_active) {
@@ -402,7 +410,6 @@ SELECT  survey.id    as id,
    *
    * @return mixed|null
    * @static
-   *
    */
   public static function del($id) {
     if (!$id) {
@@ -424,7 +431,8 @@ SELECT  survey.id    as id,
    * @param array $returnProperties
    *   An array of return elements.
    *
-   * @return array $voterDetails array of contact info.
+   * @return array
+   *   array of contact info.
    * @static
    */
   public static function voterDetails($voterIds, $returnProperties = array()) {
@@ -438,18 +446,20 @@ SELECT  survey.id    as id,
         'contact_autocomplete_options'
       );
       $returnProperties = array_fill_keys(array_merge(array(
-        'contact_type',
-            'contact_sub_type',
-            'sort_name',
-          ),
-          array_keys($autocompleteContactSearch)
-        ), 1);
+          'contact_type',
+          'contact_sub_type',
+          'sort_name',
+        ),
+        array_keys($autocompleteContactSearch)
+      ), 1);
     }
 
     $select = $from = array();
     foreach ($returnProperties as $property => $ignore) {
       $value = (in_array($property, array(
-        'city', 'street_address'))) ? 'address' : $property;
+        'city',
+        'street_address'
+      ))) ? 'address' : $property;
       switch ($property) {
         case 'sort_name':
         case 'contact_type':
@@ -479,9 +489,9 @@ SELECT  survey.id    as id,
 
     //finally retrieve contact details.
     if (!empty($select) && !empty($from)) {
-      $fromClause   = implode(' ', $from);
+      $fromClause = implode(' ', $from);
       $selectClause = implode(', ', $select);
-      $whereClause  = "contact.id IN (" . implode(',', $voterIds) . ')';
+      $whereClause = "contact.id IN (" . implode(',', $voterIds) . ')';
 
       $query = "
   SELECT  contact.id as contactId, $selectClause
@@ -518,11 +528,13 @@ Group By  contact.id";
    * @param int $interviewerId
    * @param array $statusIds
    *
-   * @return array $activityDetails array of survey activity.@static
+   * @return array
+   *   array of survey activity.
+   * @static
    */
   static function voterActivityDetails(
     $surveyId, $voterIds, $interviewerId = NULL,
-                                       $statusIds = array()) {
+    $statusIds = array()) {
     $activityDetails = array();
     if (!$surveyId ||
       !is_array($voterIds) || empty($voterIds)
@@ -575,13 +587,14 @@ INNER JOIN  civicrm_activity_contact activityAssignment
    * This function retrieve survey related activities.
    *
    * @param int $surveyId
-   *   Survey id.
-   *
    * @param int $interviewerId
-   * @param null $statusIds
-   * @param null $voterIds
+   * @param array $statusIds
+   * @param array $voterIds
    * @param bool $onlyCount
-   * @return array $activities an array of survey activity.@static
+   *
+   * @return array
+   *   An array of survey activity.
+   * @static
    */
   static function getSurveyActivities(
     $surveyId,
@@ -650,7 +663,7 @@ INNER JOIN  civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
             $whereClause";
 
     $params = array(
-    1 => array($surveyId, 'Integer'),
+      1 => array($surveyId, 'Integer'),
       2 => array($actTypeId, 'Integer'),
     );
 
@@ -677,7 +690,7 @@ INNER JOIN  civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
   }
 
   /**
-   * This function retrieve survey voter information.
+   * Retrieve survey voter information.
    *
    * @param int $surveyId
    *   Survey id.
@@ -686,7 +699,8 @@ INNER JOIN  civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
    * @param array $statusIds
    *   Survey status ids.
    *
-   * @return array $$contactIds survey related contact ids.
+   * @return array
+   *   Survey related contact ids.
    * @static
    */
   public static function getSurveyVoterInfo($surveyId, $interviewerId = NULL, $statusIds = array()) {
@@ -719,14 +733,16 @@ INNER JOIN  civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
    * This function retrieve all option groups which are created as a result set
    *
    * @param string $valueColumnName
-   * @return array $resultSets an array of option groups.@static
+   * @return array
+   *   an array of option groups.
+   * @static
    */
   public static function getResultSets($valueColumnName = 'title') {
     $resultSets = array();
     $valueColumnName = CRM_Utils_Type::escape($valueColumnName, 'String');
 
-    $query      = "SELECT id, {$valueColumnName} FROM civicrm_option_group WHERE name LIKE 'civicrm_survey_%' AND is_active=1";
-    $dao        = CRM_Core_DAO::executeQuery($query);
+    $query = "SELECT id, {$valueColumnName} FROM civicrm_option_group WHERE name LIKE 'civicrm_survey_%' AND is_active=1";
+    $dao = CRM_Core_DAO::executeQuery($query);
     while ($dao->fetch()) {
       $resultSets[$dao->id] = $dao->$valueColumnName;
     }
@@ -735,11 +751,11 @@ INNER JOIN  civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
   }
 
   /**
-   * This function is to check survey activity.
+   * check survey activity.
    *
    * @param int $activityId
    *   Activity id.
-   * @return boolean $isSurveyActivity true/false
+   * @return boolean
    * @static
    */
   public static function isSurveyActivity($activityId) {
@@ -768,7 +784,9 @@ INNER JOIN  civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
    *
    * @param int $surveyId
    *   Survey id.
-   * @return array $responseOptions an array of option values@static
+   * @return array
+   *   an array of option values
+   * @static
    */
   public static function getResponsesOptions($surveyId) {
     $responseOptions = array();
@@ -790,7 +808,9 @@ INNER JOIN  civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
    * @param int $surveyId
    * @param bool $enclosedInUL
    * @param string $extraULName
-   * @return array|string $url array of permissioned links@static
+   * @return array|string
+   *   $url array of permissioned links
+   * @static
    */
   public static function buildPermissionLinks($surveyId, $enclosedInUL = FALSE, $extraULName = 'more') {
     $menuLinks = array();
@@ -838,11 +858,11 @@ INNER JOIN  civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
       if ($reportID) {
         $voterLinks['report'] =
           array(
-                'name' => 'report',
-                'url'  => "civicrm/report/instance/{$reportID}",
-                'qs'   => 'reset=1',
-                'title' => ts('View Survey Report'),
-                );
+            'name' => 'report',
+            'url' => "civicrm/report/instance/{$reportID}",
+            'qs' => 'reset=1',
+            'title' => ts('View Survey Report'),
+          );
       }
     }
 
@@ -874,7 +894,6 @@ INNER JOIN  civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
 
   /**
    * Retrieve survey associated profile id.
-   *
    */
   public static function getSurveyProfileId($surveyId) {
     if (!$surveyId) {
@@ -921,7 +940,6 @@ INNER JOIN  civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
 
   /**
    * Decides the contact type for given survey.
-   *
    */
   public static function getSurveyContactType($surveyId) {
     $contactType = NULL;
@@ -940,7 +958,6 @@ INNER JOIN  civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
 
   /**
    * Get survey supportable profile types
-   *
    */
   public static function surveyProfileTypes() {
     static $profileTypes;
@@ -962,7 +979,8 @@ INNER JOIN  civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
    * @param int $surveyTypeId
    *   Survey activity type id.
    *
-   * @return array an array of valid survey response fields.
+   * @return array
+   *   an array of valid survey response fields.
    */
   public static function getSurveyResponseFields($surveyId, $surveyTypeId = NULL) {
     if (empty($surveyId)) {
@@ -1029,7 +1047,8 @@ INNER JOIN  civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
   /**
    * Get all interviewers of surveys.
    *
-   * @return array an array of valid survey response fields.
+   * @return array
+   *   an array of valid survey response fields.
    */
   public static function getInterviewers() {
     static $interviewers;
@@ -1070,7 +1089,8 @@ INNER JOIN  civicrm_survey survey ON ( activity.source_record_id = survey.id )
    *
    * @param array $params
    *
-   * @return array success message
+   * @return array
+   *   success message
    */
   public static function releaseRespondent($params) {
     $activityStatus = CRM_Core_PseudoConstant::activityStatus('name');
@@ -1131,8 +1151,8 @@ UPDATE  civicrm_activity
    * @see CRM_Core_DAO::buildOptions
    *
    * @param string $fieldName
-   * @param string $context: @see CRM_Core_DAO::buildOptionsContext
-   * @param array $props: whatever is known about this dao object
+   * @param string $context : @see CRM_Core_DAO::buildOptionsContext
+   * @param array $props : whatever is known about this dao object
    *
    * @return array|bool
    */