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

Adding method chaining into the Mail helpers' setters #287

Closed
wants to merge 18 commits into from

Conversation

vitya1
Copy link

@vitya1 vitya1 commented Sep 5, 2016

No description provided.

@thinkingserious
Copy link
Contributor

This is awesome @vitya1!

Could you please sign our CLA so I can merge this? https://github.com/sendgrid/sendgrid-php/blob/master/CONTRIBUTING.md#cla

@vitya1
Copy link
Author

vitya1 commented Sep 7, 2016

@thinkingserious I did

@thinkingserious thinkingserious added type: community enhancement feature request not on Twilio's roadmap status: cla signed labels Sep 9, 2016
@vitya1
Copy link
Author

vitya1 commented Sep 13, 2016

Here is big psr-4 refactoring in additional to the main commit

@thinkingserious
Copy link
Contributor

Hi @vitya1,

Could you please resolve the conflicts so that I may test and merge? Thanks!

@vitya1
Copy link
Author

vitya1 commented Sep 14, 2016

Hi @thinkingserious. Conflicts have fixed!

Copy link
Contributor

@thinkingserious thinkingserious left a comment

Choose a reason for hiding this comment

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

Great work!

I have one change request. The Mail Helper is supposed to be a single unit, so let's move it to lib\Helper\Mail\Mail.php (and the rest of the classes to lib\Helper\Mail\Objects or similar), so that I can just do use SendGrid\Helper\Mail. The next two helpers we plan to add are for templates and attachments. Those would be under lib\Helper\Templates and lib\Helper\Attachments.

Please let me know if you have questions about this or have other ideas.

@vitya1
Copy link
Author

vitya1 commented Sep 15, 2016

As my mind, in case you plan to add pretty big number of classes in lib\Helper\Templates or lib\Helper\Attachments - it's good idea to group helper's classes. But if you just want to extend mail helper functional - better do not move classes for some time. For ex. maybe better to extend existing Attachment class (especially it has only getters and setters)?

@thinkingserious
Copy link
Contributor

@vitya1,

Thanks for taking the time to elaborate your thoughts. Your proposal makes sense.

I would suggest we then just move everything to Helper\Mail. So that if we create a helper for say, contact management, that would go in Helper\ContactManagement

@vitya1
Copy link
Author

vitya1 commented Sep 15, 2016

Ok, let I move

@vitya1
Copy link
Author

vitya1 commented Sep 19, 2016

Done

@thinkingserious
Copy link
Contributor

@vitya1

Can you please update the dependency to php-http-client to v3.4?

Check out this release: sendgrid/php-http-client#6

Thanks!

@vitya1
Copy link
Author

vitya1 commented Sep 27, 2016

@thinkingserious
Sure

@thinkingserious
Copy link
Contributor

@vitya1,

Ah, your tests are failing because of this pull request: sendgrid/php-http-client#9

Could you please update your tests accordingly?

Also, please use:
"sendgrid/php-http-client": "~3.4"

Thanks!

@vitya1
Copy link
Author

vitya1 commented Sep 27, 2016

@thinkingserious
forgot about tests, but now it's ok.

@thinkingserious
Copy link
Contributor

@vitya1,

It looks like we have some conflicts now. Could you please update the branch? Thanks!

@vitya1
Copy link
Author

vitya1 commented Oct 6, 2016

@thinkingserious,
Done. All conflicts are fixed now. Could the branch be merged before the next ones?

@thinkingserious
Copy link
Contributor

@vitya1,

This ticket finally came back up to the top of our queue. It looks like it needs some further conflicts to be resolved. Can you take care of that please? Thanks!

@vitya1
Copy link
Author

vitya1 commented Oct 13, 2016

@thinkingserious, it's actually nice.
I resolved conflicts and the branch good to merge

@SendGridDX
Copy link

SendGridDX commented May 23, 2017

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 4 committers have signed the CLA.

✅ vitya1
✅ thinkingserious
❌ Victor Sheremetov
❌ skytime


Victor Sheremetov, skytime seem not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@vitya1
Copy link
Author

vitya1 commented May 23, 2017

@thinkingserious
Finally, I did it. But I'm not sure about version. It was 6.0.0 in my old commits, actual product version is 5.X.X. Could you check which is correct?

@thinkingserious
Copy link
Contributor

Hello @vitya1,

Thanks!

Please revert any changes relating to versioning. You can leave those as-is. I will go ahead and update those after merge.

Additionally, it looks like there are several people who have contributed commits that have not signed a CLA. I can not merge these changes unless everyone who has committed signs the CLA. This is now much easier, just click on the link and there is short form to fill out. No more downloading and signing. But, each person must have an email attached to their GitHub account. Please advise.

With Best Regards,

Elmer

@thinkingserious
Copy link
Contributor

Hi @vitya1,

Is there anything I can do to help?

@vitya1
Copy link
Author

vitya1 commented Jun 22, 2017

Hi @thinkingserious,
These commits were made in some different computers with different git author configurations. And unfortunately I don't access to one of those emails now :(
And that is a trouble with signing.

@vitya1
Copy link
Author

vitya1 commented Jun 22, 2017

I can try to cherry pick commits to another branch, but I'm not sure it will be helpful.
How do you think?

@thinkingserious
Copy link
Contributor

Hi @vitya1,

Since we can't merge this as is, I would suggest you create a new PR with your current GitHUb account. I hope that is not too much trouble :(

With Best Regards,

Elmer

* @package SendGrid\Helper
*/
class Attachment implements \JsonSerializable
{
Copy link

@albert-agelviz albert-agelviz Sep 11, 2017

Choose a reason for hiding this comment

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

If a user needs an Attachment, why can't we use the constructor to set the properties?, also, I don't see any type hint in the code, this feature has been able since 5.1 version and we have a base compatibility with 5.6.

No doc blocks, if I want to contribute, I need to know what values I expect for the scalar values since these can't be type hinted, please add them, let the people understand your code !

instead of setContent($content what about setContent(Content $content), or better yet:

public function __construct(Content $content, Type $type... etc)

* Class BccSettings
* @package SendGrid\Helper
*/
class BccSettings implements \JsonSerializable

Choose a reason for hiding this comment

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

Same comment for Attachment.

* Class BypassListManagement
* @package SendGrid\Helper
*/
class BypassListManagement implements \JsonSerializable

Choose a reason for hiding this comment

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

Same comment for Attachment.

* Class ClickTracking
* @package SendGrid
*/
class ClickTracking implements \JsonSerializable

Choose a reason for hiding this comment

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

Same comment for Attachment.

* Class Content
* @package SendGrid\Helper
*/
class Content implements \JsonSerializable

Choose a reason for hiding this comment

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

Same comment for Attachment.

* Class Email
* @package SendGrid\Helper
*/
class Email implements \JsonSerializable

Choose a reason for hiding this comment

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

Same comment for Attachment.

Also, this is a Value Object, why are we not validating it?, what if I pass to $email an integer? or ¯\_(ツ)_/¯ as value?, please, let's validate our Value Objects and help our base class Mail to be always in a valid state !.

* Class Footer
* @package SendGrid\Helper
*/
class Footer implements \JsonSerializable

Choose a reason for hiding this comment

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

Same comment for Attachment.

* Class Ganalytics
* @package SendGrid\Helper
*/
class Ganalytics implements \JsonSerializable

Choose a reason for hiding this comment

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

Same comment for Attachment.

* Class Mail
* @package SendGrid\Helper
*/
class Mail implements \JsonSerializable

Choose a reason for hiding this comment

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

Same comment for Attachment.

And also, Public properties?, why?, this is a very delicate class !, it represents the message that will be send !, let's be more strict and make them private, and type hint people, let's type hint more !!, it doesn't hurt.

* Class MailSettings
* @package SendGrid\Helper
*/
class MailSettings implements \JsonSerializable

Choose a reason for hiding this comment

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

Same comment for Attachment.

* Class OpenTracking
* @package SendGrid\Helper
*/
class OpenTracking implements \JsonSerializable

Choose a reason for hiding this comment

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

Same comment for Attachment.

* Class Personalization
* @package SendGrid\Helper
*/
class Personalization implements \JsonSerializable

Choose a reason for hiding this comment

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

Same comment for Attachment.

* Class ReplyTo
* @package SendGrid
*/
class ReplyTo implements \JsonSerializable

Choose a reason for hiding this comment

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

Same comment for Attachment.

* Class SandBoxMode
* @package SendGrid\Helper
*/
class SandBoxMode implements \JsonSerializable

Choose a reason for hiding this comment

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

Same comment for Attachment.

* Class SubscriptionTracking
* @package SendGrid\Helper
*/
class SubscriptionTracking implements \JsonSerializable

Choose a reason for hiding this comment

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

Same comment for Attachment.

* Class TrackingSettings
* @package SendGrid\Helper
*/
class TrackingSettings implements \JsonSerializable

Choose a reason for hiding this comment

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

Same comment for Attachment.

@albert-agelviz
Copy link

Made some comments for this PR @thinkingserious , also I don't see any new tests in this PR, we should be very strict to don't consider any PR without unit, functional or integrations tests (if tests are required of course 😄 )

@thinkingserious
Copy link
Contributor

Thanks for taking the time to review @shonjord!

@thinkingserious
Copy link
Contributor

thinkingserious commented Sep 12, 2017

Hi @vitya1,

I will be incorporating some of your changes to the internals of the new library and you will be credited accordingly. For now, I would greatly appreciate your feedback here.

With Best Regards,

Elmer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: community enhancement feature request not on Twilio's roadmap
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants