From 607fa3080176ed9cd8d01fa997db80117b91657d Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sat, 7 Mar 2015 23:05:07 +1100 Subject: [PATCH] more phpcs tidy up --- CRM/Contact/BAO/GroupNesting.php | 3 +++ CRM/Contact/BAO/ProximityQuery.php | 1 + CRM/Contact/Form/Relationship.php | 37 +++++++++++++++--------------- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/CRM/Contact/BAO/GroupNesting.php b/CRM/Contact/BAO/GroupNesting.php index 3d834d197f..03522d43af 100644 --- a/CRM/Contact/BAO/GroupNesting.php +++ b/CRM/Contact/BAO/GroupNesting.php @@ -51,6 +51,9 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen /** * Class constructor. + * + * @param bool $styleLabels + * @param string $styleIndent */ public function __construct($styleLabels = FALSE, $styleIndent = " -- ") { parent::__construct(); diff --git a/CRM/Contact/BAO/ProximityQuery.php b/CRM/Contact/BAO/ProximityQuery.php index ef20040094..39e8c9292c 100644 --- a/CRM/Contact/BAO/ProximityQuery.php +++ b/CRM/Contact/BAO/ProximityQuery.php @@ -98,6 +98,7 @@ class CRM_Contact_BAO_ProximityQuery { * @param float $longitude * @param float $latitude * @param float $height + * * @return array */ public static function earthXYZ($longitude, $latitude, $height = 0) { diff --git a/CRM/Contact/Form/Relationship.php b/CRM/Contact/Form/Relationship.php index bfeaea7b48..a7157683a2 100644 --- a/CRM/Contact/Form/Relationship.php +++ b/CRM/Contact/Form/Relationship.php @@ -277,8 +277,6 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { /** * Build the form object. - * - * @return void */ public function buildQuickForm() { if ($this->_cdType) { @@ -438,8 +436,9 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { ); // Save relationships - list($valid, $invalid, $duplicate, $saved, $relationshipIds) = CRM_Contact_BAO_Relationship::createMultiple ($params, $relationshipTypeParts[1]); - $this->setMessage($valid, $invalid, $duplicate, $saved); + $outcome = CRM_Contact_BAO_Relationship::createMultiple($params, $relationshipTypeParts[1]); + list($valid, $invalid, $duplicate, $saved, $relationshipIds) = $outcome; + $this->setMessage($outcome); // if this is called from case view, //create an activity for case role removal.CRM-4480 @@ -537,37 +536,39 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form { /** * Set Status message to reflect outcome of the update action. * - * @param int $valid Number of valid relationships attempted. - * @param int $invalid Number of invalid relationships attempted. - * @param int $duplicate Number of duplicate relationships attempted. - * @param int $saved Number of relationships saved. + * @param array $outcome + * Outcome of save action - including + * - 'valid' : Number of valid relationships attempted. + * - 'invalid' : Number of invalid relationships attempted. + * - 'duplicate' : Number of duplicate relationships attempted. + * - 'saved' : boolean of whether save was successful */ - protected function setMessage($valid, $invalid, $duplicate, $saved) { - if ($valid) { + protected function setMessage($outcome) { + if (!empty($outcome['valid'])) { CRM_Core_Session::setStatus(ts('Relationship created.', array( - 'count' => $valid, + 'count' => $outcome['valid'], 'plural' => '%count relationships created.', )), ts('Saved'), 'success'); } - if ($invalid) { + if (!empty($outcome['invalid'])) { CRM_Core_Session::setStatus(ts('%count relationship record was not created due to an invalid contact type.', array( - 'count' => $invalid, + 'count' => $outcome['invalid'], 'plural' => '%count relationship records were not created due to invalid contact types.', )), ts('%count invalid relationship record', array( - 'count' => $invalid, + 'count' => $outcome['invalid'], 'plural' => '%count invalid relationship records', ))); } - if ($duplicate) { + if (!empty($outcome['duplicate'])) { CRM_Core_Session::setStatus(ts('One relationship was not created because it already exists.', array( - 'count' => $duplicate, + 'count' => $outcome['duplicate'], 'plural' => '%count relationships were not created because they already exist.', )), ts('%count duplicate relationship', array( - 'count' => $duplicate, + 'count' => $outcome['duplicate'], 'plural' => '%count duplicate relationships', ))); } - if ($saved) { + if (!empty($outcome['saved'])) { CRM_Core_Session::setStatus(ts('Relationship record has been updated.'), ts('Saved'), 'success'); } } -- 2.25.1