From bc854509a58b5065c61167b9a569cf7bcd512c7d Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 10 Jan 2017 12:45:32 +1300 Subject: [PATCH] Add comment blocks --- CRM/Admin/Page/ExtensionsUpgrade.php | 3 +++ CRM/Contribute/BAO/Contribution.php | 19 +++++++++++++------ CRM/Contribute/Form/Task.php | 2 ++ CRM/Contribute/Form/Task/Status.php | 6 ++++++ CRM/Contribute/Tokens.php | 12 ++++++++++++ CRM/Core/BAO/UFGroup.php | 5 +++++ CRM/Core/CodeGen/DAO.php | 6 ++++++ CRM/Core/Payment/PayJunction.php | 5 +++-- CRM/Dedupe/Merger.php | 21 +++++++++++++++++++++ CRM/Mailing/Selector/Event.php | 10 ++++++++++ CRM/Report/Form/ActivitySummary.php | 5 +++++ CRM/Upgrade/Incremental/php/FourSeven.php | 5 +++++ CRM/Utils/Array.php | 17 +++++++++++++++++ CRM/Utils/SQL/Select.php | 7 +++++++ CRM/Utils/System/Base.php | 7 +++++++ CRM/Utils/System/DrupalBase.php | 7 +++++++ 16 files changed, 129 insertions(+), 8 deletions(-) diff --git a/CRM/Admin/Page/ExtensionsUpgrade.php b/CRM/Admin/Page/ExtensionsUpgrade.php index 1c7d0d861c..2b5c610503 100644 --- a/CRM/Admin/Page/ExtensionsUpgrade.php +++ b/CRM/Admin/Page/ExtensionsUpgrade.php @@ -10,6 +10,9 @@ class CRM_Admin_Page_ExtensionsUpgrade extends CRM_Core_Page { const END_URL = 'civicrm/admin/extensions'; const END_PARAMS = 'reset=1'; + /** + * Run Page. + */ public function run() { $queue = CRM_Extension_Upgrades::createQueue(); $runner = new CRM_Queue_Runner(array( diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 6aad349a2a..e74a29f2f0 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -3769,6 +3769,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac * @param string $paymentType * 'owed' for purpose of recording partial payments, 'refund' for purpose of recording refund payments. * @param int $participantId + * @param bool $updateStatus * * @return null|object */ @@ -4330,9 +4331,11 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']}) /** * Compute the stats values * - * @param $stat either 'mode' or 'median' - * @param $sql - * @param $alias of civicrm_contribution + * @param string $stat either 'mode' or 'median' + * @param string $sql + * @param string $alias of civicrm_contribution + * + * @return array|null */ public static function computeStats($stat, $sql, $alias = NULL) { $mode = $median = array(); @@ -4385,7 +4388,7 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']}) return $median; default: - return; + return NULL; } } @@ -4422,6 +4425,8 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']}) * Duplication of param needs review. Only used by AuthorizeNetIPN * @param int $isFirstOrLastRecurringPayment * Deprecated param only used by AuthorizeNetIPN. + * + * @return array */ public static function completeOrder(&$input, &$ids, $objects, $transaction, $recur, $contribution, $isRecurring, $isFirstOrLastRecurringPayment) { $primaryContributionID = isset($contribution->id) ? $contribution->id : $objects['first_contribution']->id; @@ -4946,11 +4951,12 @@ LIMIT 1;"; } /** - * Function to check line items + * Function to check line items. * * @param array $params * array of order params. * + * @throws \API_Exception */ public static function checkLineItems(&$params) { $totalAmount = CRM_Utils_Array::value('total_amount', $params); @@ -5392,8 +5398,9 @@ LEFT JOIN civicrm_contribution on (civicrm_contribution.contact_id = civicrm_co /** * Create array of last financial item id's. * - * @param array $contributionId + * @param int $contributionId * + * @return array */ public static function getLastFinancialItemIds($contributionId) { $sql = "SELECT fi.id, li.price_field_value_id, li.tax_amount, fi.financial_account_id diff --git a/CRM/Contribute/Form/Task.php b/CRM/Contribute/Form/Task.php index 6127a5d243..fdbcbd18d0 100644 --- a/CRM/Contribute/Form/Task.php +++ b/CRM/Contribute/Form/Task.php @@ -186,6 +186,8 @@ class CRM_Contribute_Form_Task extends CRM_Core_Form { /** * Sets contribution Ids for unit test. + * + * @param array $contributionIds */ public function setContributionIds($contributionIds) { $this->_contributionIds = $contributionIds; diff --git a/CRM/Contribute/Form/Task/Status.php b/CRM/Contribute/Form/Task/Status.php index 18cb54305d..a3535e5cbe 100644 --- a/CRM/Contribute/Form/Task/Status.php +++ b/CRM/Contribute/Form/Task/Status.php @@ -218,7 +218,13 @@ AND co.id IN ( $contribIDs )"; /** * Process the form with submitted params. + * * Also supports unit test. + * + * @param CRM_Core_Form $form + * @param array $params + * + * @throws \Exception */ public static function processForm($form, $params) { $statusID = CRM_Utils_Array::value('contribution_status_id', $params); diff --git a/CRM/Contribute/Tokens.php b/CRM/Contribute/Tokens.php index 0a30239c0e..c7fe1fdbda 100644 --- a/CRM/Contribute/Tokens.php +++ b/CRM/Contribute/Tokens.php @@ -88,12 +88,24 @@ class CRM_Contribute_Tokens extends \Civi\Token\AbstractTokenSubscriber { parent::__construct('contribution', $tokens); } + /** + * Check if the token processor is active. + * + * @param \Civi\Token\TokenProcessor $processor + * + * @return bool + */ public function checkActive(\Civi\Token\TokenProcessor $processor) { return !empty($processor->context['actionMapping']) && $processor->context['actionMapping']->getEntity() === 'civicrm_contribution'; } + /** + * Alter action schedule query. + * + * @param \Civi\ActionSchedule\Event\MailingQueryEvent $e + */ public function alterActionScheduleQuery(\Civi\ActionSchedule\Event\MailingQueryEvent $e) { if ($e->mapping->getEntity() !== 'civicrm_contribution') { return; diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index efb0015336..4910f4ad71 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -666,6 +666,11 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup { return $importableFields; } + /** + * Get the fields relating to locations. + * + * @return array + */ public static function getLocationFields() { static $locationFields = array( 'street_address', diff --git a/CRM/Core/CodeGen/DAO.php b/CRM/Core/CodeGen/DAO.php index 503ba3eb24..65dd5b82e4 100644 --- a/CRM/Core/CodeGen/DAO.php +++ b/CRM/Core/CodeGen/DAO.php @@ -20,6 +20,12 @@ class CRM_Core_CodeGen_DAO extends CRM_Core_CodeGen_BaseTask { */ private $raw; + /** + * CRM_Core_CodeGen_DAO constructor. + * + * @param \CRM_Core_CodeGen_Main $config + * @param string $name + */ public function __construct($config, $name) { parent::__construct($config); $this->name = $name; diff --git a/CRM/Core/Payment/PayJunction.php b/CRM/Core/Payment/PayJunction.php index 81b113b1f5..3b70daea06 100644 --- a/CRM/Core/Payment/PayJunction.php +++ b/CRM/Core/Payment/PayJunction.php @@ -12,11 +12,12 @@ * * @package CRM * @author Michael Morris and Gene Chi @ Phase2 Technology - * $Id$ - * */ require_once 'PayJunction/pjClasses.php'; +/** + * Class CRM_Core_Payment_PayJunction. + */ class CRM_Core_Payment_PayJunction extends CRM_Core_Payment { # (not used, implicit in the API, might need to convert?) const CHARSET = 'UFT-8'; diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index a61b66ce4a..183dd63b7d 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -651,6 +651,12 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m return $where; } + /** + * Update the statistics for the merge set. + * + * @param string $cacheKeyString + * @param array $result + */ public static function updateMergeStats($cacheKeyString, $result = array()) { // gather latest stats $merged = count($result['merged']); @@ -695,6 +701,14 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m CRM_Core_BAO_PrevNextCache::deleteItem(NULL, "{$cacheKeyString}_stats"); } + /** + * Get merge outcome statistics. + * + * @param string $cacheKeyString + * + * @return array + * Array of how many were merged and how many were skipped. + */ public static function getMergeStats($cacheKeyString) { $stats = CRM_Core_BAO_PrevNextCache::retrieve("{$cacheKeyString}_stats"); if (!empty($stats)) { @@ -703,6 +717,13 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m return $stats; } + /** + * Get merge statistics message. + * + * @param string $cacheKeyString + * + * @return string + */ public static function getMergeStatsMsg($cacheKeyString) { $msg = ''; $stats = CRM_Dedupe_Merger::getMergeStats($cacheKeyString); diff --git a/CRM/Mailing/Selector/Event.php b/CRM/Mailing/Selector/Event.php index 7983727a2b..c7db96ca4c 100644 --- a/CRM/Mailing/Selector/Event.php +++ b/CRM/Mailing/Selector/Event.php @@ -439,6 +439,11 @@ class CRM_Mailing_Selector_Event extends CRM_Core_Selector_Base implements CRM_C return NULL; } + /** + * Get the title for the mailing event type. + * + * @return string + */ public function eventToTitle() { static $events = NULL; @@ -458,6 +463,11 @@ class CRM_Mailing_Selector_Event extends CRM_Core_Selector_Base implements CRM_C return $events[$this->_event_type]; } + /** + * Get the title of the event. + * + * @return string + */ public function getTitle() { return $this->eventToTitle(); } diff --git a/CRM/Report/Form/ActivitySummary.php b/CRM/Report/Form/ActivitySummary.php index a3a4bd75e4..e6041b1901 100644 --- a/CRM/Report/Form/ActivitySummary.php +++ b/CRM/Report/Form/ActivitySummary.php @@ -417,6 +417,11 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form { } } + /** + * Group the fields. + * + * @param bool $includeSelectCol + */ public function groupBy($includeSelectCol = TRUE) { $this->_groupBy = array(); if (!empty($this->_params['group_bys']) && diff --git a/CRM/Upgrade/Incremental/php/FourSeven.php b/CRM/Upgrade/Incremental/php/FourSeven.php index 2743465d05..a1a3c58152 100644 --- a/CRM/Upgrade/Incremental/php/FourSeven.php +++ b/CRM/Upgrade/Incremental/php/FourSeven.php @@ -895,6 +895,11 @@ FROM `civicrm_dashboard_contact` JOIN `civicrm_contact` WHERE civicrm_dashboard_ return TRUE; } + /** + * Add mailing template type. + * + * @return bool + */ public static function addMailingTemplateType() { if (!CRM_Core_DAO::checkFieldExists('civicrm_mailing', 'template_type', FALSE)) { CRM_Core_DAO::executeQuery(' diff --git a/CRM/Utils/Array.php b/CRM/Utils/Array.php index 3a8bca6ddf..54c567e9e1 100644 --- a/CRM/Utils/Array.php +++ b/CRM/Utils/Array.php @@ -1098,6 +1098,14 @@ class CRM_Utils_Array { return $array; } + /** + * Build tree of elements. + * + * @param array $elements + * @param int|null $parentId + * + * @return array + */ public static function buildTree($elements, $parentId = NULL) { $branch = array(); @@ -1114,6 +1122,15 @@ class CRM_Utils_Array { return $branch; } + /** + * Find search string in tree. + * + * @param string $search + * @param array $tree + * @param string $field + * + * @return array|null + */ public static function findInTree($search, $tree, $field = 'id') { foreach ($tree as $item) { if ($item[$field] == $search) { diff --git a/CRM/Utils/SQL/Select.php b/CRM/Utils/SQL/Select.php index 24ca2587d5..8d0db8a74f 100644 --- a/CRM/Utils/SQL/Select.php +++ b/CRM/Utils/SQL/Select.php @@ -585,6 +585,13 @@ class CRM_Utils_SQL_Select implements ArrayAccess { return $sql; } + /** + * Has an offset been set. + * + * @param string $offset + * + * @return bool + */ public function offsetExists($offset) { return isset($this->params[$offset]); } diff --git a/CRM/Utils/System/Base.php b/CRM/Utils/System/Base.php index b3f8dcb443..652a0f5baf 100644 --- a/CRM/Utils/System/Base.php +++ b/CRM/Utils/System/Base.php @@ -423,6 +423,13 @@ abstract class CRM_Utils_System_Base { throw new CRM_Core_Exception("Not implemented: {$className}->getUfId"); } + /** + * Set the localisation from the user framework. + * + * @param string $civicrm_language + * + * @return bool + */ public function setUFLocale($civicrm_language) { return TRUE; } diff --git a/CRM/Utils/System/DrupalBase.php b/CRM/Utils/System/DrupalBase.php index 4edfb7687e..54beb6fedf 100644 --- a/CRM/Utils/System/DrupalBase.php +++ b/CRM/Utils/System/DrupalBase.php @@ -545,6 +545,13 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { return user_load($userID); } + /** + * Parse the name of the drupal site. + * + * @param string $civicrm_root + * + * @return null|string + */ public function parseDrupalSiteName($civicrm_root) { $siteName = NULL; if (strpos($civicrm_root, -- 2.25.1