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

Moved email attachments into an array #1377

Closed
wants to merge 1 commit into from
Closed

Moved email attachments into an array #1377

wants to merge 1 commit into from

Conversation

anthonysterling
Copy link

I've consolidated the $attach(name|type|disp) properties into an
array. I think the code looks a little cleaner this way, and I could
not see a reason not to refactor.

Feedback appreciated.

Anthony.

I've consolidated the $_attach_(name|type|disp) properties into an
array. I think the code looks a little cleaner this way, and I could
not see a reason not to refactor.

Feedback appreciated.

Anthony.
@@ -1035,49 +1033,41 @@ protected function _build_message()
break;
}

$attachment = array();
for ($i = 0, $c = count($this->_attach_name), $z = 0; $i < $c; $i++)
foreach ($this->_attachments as $attachment)
Copy link
Contributor

Choose a reason for hiding this comment

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

While the for() loop was functionally needed with the 3 arrays, it's also typically faster and there's no reason to change it to a foreach().

Copy link
Contributor

Choose a reason for hiding this comment

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

I think for readability now that this is a multi-dim array its ok to change it to a foreach. The speed different is infintessimal and thanks to all the other speed improvements you've made we can probably afford to lose this 0.000001 second change in the 3.0 branch. :)

Copy link
Author

Choose a reason for hiding this comment

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

Do you not think it's a little cleaner? It also reduces LOC by ~25% whilst doing so. Obviously your call, but I'll add a test to this and leave it with you.

Anthony.

Copy link
Contributor

Choose a reason for hiding this comment

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

I personally would always chose for() over foreach(). But it's Phil's call as well and our arguments differ, so I guess it doesn't really matter.
What's LOC?

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, LOC.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's stick with the foreach, it makes things nice and readable.

When that other commit is in and the test is written I'll be happy to merge this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants