Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] minor refactor towards removing complexity. #15593

Merged
merged 1 commit into from
Oct 25, 2019

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Minor code legibility improvement.

Before

Less readable

After

More readable.

Technical Details

This change actually makes the foreach & if following it redundant. I left them out for legibility
but basically all the wrangling is on the 'other' contact. We do just one thing with the 'main'
contact so the whole foreach & if is silly. Will follow up with removal of those

Comments

This change actually makes the foreach & if following it redundant. I left them out for legibility
but basically all the wrangling is on the 'other' contact. We do just one thing with the 'main'
contact so the whole foreach & if is silly. Will follow up with removal of those
@civibot
Copy link

civibot bot commented Oct 24, 2019

(Standard links)

@eileenmcnaughton
Copy link
Contributor Author

unrelated fail

@eileenmcnaughton
Copy link
Contributor Author

test this please

$rows["move_$field"]['main'] = self::getFieldValueAndLabel($field, $main)['label'];
$rows["move_$field"]['other'] = self::getFieldValueAndLabel($field, $other)['label'];

foreach (['other' => $other] as $moniker => $contact) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Err, this is a foreach with only one item in the array, followed by a conditional checking to see if we are looping on the one and only item. Surely both of those can be eliminated now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@colemanw yes - I did the version with it removed here #15594 but it's hard to read that one hence I created an interim PR - see PR template

@mattwire mattwire merged commit 2fd7260 into civicrm:master Oct 25, 2019
@eileenmcnaughton eileenmcnaughton deleted the dedupe branch October 25, 2019 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants