From 8efea814e4c9017fd7b0c1ef8adae8fd5e679593 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sat, 3 May 2014 11:44:28 -0700 Subject: [PATCH] comments & formatting fixes --- CRM/Contribute/BAO/Contribution.php | 8 ++++-- CRM/Member/BAO/Membership.php | 27 ++++++++++++------- CRM/Member/Form/Membership.php | 9 ++++--- .../phpunit/api/v3/SyntaxConformanceTest.php | 19 ++++++++++--- 4 files changed, 44 insertions(+), 19 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index d4564a378f..04e461e146 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -491,6 +491,9 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { * scheme. Adding weight is super important and should be done in the * next week or so, before this can be called complete. * + * @param string $contactType + * @param bool $status + * * @return array array of importable Fields * @access public * @static @@ -690,8 +693,9 @@ INNER JOIN civicrm_contact contact ON ( contact.id = civicrm_contribution.conta /** * Delete the indirect records associated with this contribution first * - * @return $results no of deleted Contribution on success, false otherwise - * @access public + * @param $id + * + * @return mixed|null $results no of deleted Contribution on success, false otherwise@access public * @static */ static function deleteContribution($id) { diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index fd53c7a396..39f92236d8 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -216,9 +216,13 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { /** * takes an associative array and creates a membership object * - * @param array $params (reference ) an assoc array of name/value pairs - * @param array $ids the array that holds all the db ids - * @param boolean $callFromAPI Is this function called from API? + * @param array $params (reference ) an assoc array of name/value pairs + * @param array $ids the array that holds all the db ids + * @param bool $skipRedirect + * @param string $activityType + * + * @throws CRM_Core_Exception + * @internal param bool $callFromAPI Is this function called from API? * * @return object CRM_Member_BAO_Membership object * @access public @@ -270,7 +274,8 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { // CRM_Contact_BAO_Relationship::relatedMemberships() if (isset($params['owner_membership_id'])) { unset($params['max_related']); - } else { + } + else { // if membership allows related, default max_related to value in membership_type if (!array_key_exists('max_related', $params) && !empty($params['membership_type_id'])) { $membershipType = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($params['membership_type_id']); @@ -477,10 +482,11 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { * full featured over a period of time. This is the inverse function of * create. It also stores all the retrieved values in the default array * - * @param array $params (reference ) an assoc array of name/value pairs + * @param array $params (reference ) an assoc array of name/value pairs * @param array $defaults (reference ) an assoc array to hold the name / value pairs * in a hierarchical manner - * @param array $ids (reference) the array that holds all the db ids + * + * @internal param array $ids (reference) the array that holds all the db ids * * @return object CRM_Member_BAO_Membership object * @access public @@ -2010,8 +2016,10 @@ WHERE civicrm_membership.contact_id = civicrm_contact.id * function to create memberships for related contacts * takes into account the maximum related memberships * - * @param array $params array of key - value pairs - * @param object $membership membership object + * @param array $params array of key - value pairs + * @param $dao + * + * @internal param object $membership membership object * * @return null|relatedMembership array of memberships if created * @static @@ -2144,7 +2152,8 @@ WHERE civicrm_membership.contact_id = civicrm_contact.id if (($params['status_id'] == $deceasedStatusId) || ($params['status_id'] == $expiredStatusId)) { // related membership is not active so does not count towards maximum CRM_Member_BAO_Membership::create($params, $relMemIds); - } else { + } + else { // related membership already exists, so this is just an update if (isset($params['id'])) { if ($available > 0) { diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 8a7357c0a4..f8881395b6 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -978,9 +978,9 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; 'is_current_member' => 0, )); $tmp_statuses = $result['values']; - $status_ids = array(); + $status_ids = array(); foreach($tmp_statuses as $cur_stat) { - $status_ids[] = $cur_stat['id']; + $status_ids[] = $cur_stat['id']; } if (empty($params['status_id']) || in_array( $params['status_id'] , $status_ids) == false) { $errors['status_id'] = ts('Please enter a status that does NOT represent a current membership status.'); @@ -1736,10 +1736,11 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; /** * Function to send email receipt * - * @param object $form form object - * @param array $values submitted values + * @param object $form form object + * @param $formValues * @param object $membership object * + * @internal param array $values submitted values * @return boolean true if mail was sent successfully * @static */ diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index 30471ad329..e0eb54a8e9 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -46,6 +46,8 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { /** This test case doesn't require DB reset */ public $DBResetRequired = FALSE; + protected $_entity; + /* they are two types of missing APIs: - Those that are to be implemented (in some future version when someone steps in -hint hint-). List the entities in toBeImplemented[ {$action} ] @@ -561,7 +563,10 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { * sense for which entities support createTestObject * * @dataProvider entities_getlimit - * @param string $entity + * + * @param $entityName + * + * @internal param string $entity */ function testLimit($entityName) { $cases = array(); // each case is array(0 => $inputtedApiOptions, 1 => $expectedResultCount) @@ -1026,9 +1031,15 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { ); } -/** - * @param entityName - */private function getMockableBAOObjects($entityName, $count = 2) { + /** + * @param $entityName + * @param int $count + * + * @internal param $entityName + * + * @return array + */ + private function getMockableBAOObjects($entityName, $count = 2) { $baoString = _civicrm_api3_get_DAO($entityName); if (empty($baoString)) { $this->markTestIncomplete("Entity [$entityName] cannot be mocked - no known DAO"); -- 2.25.1