-
Notifications
You must be signed in to change notification settings - Fork 625
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
added helper for new recipient form #502
added helper for new recipient form #502
Conversation
lib/helpers/contacts/Recipients.php
Outdated
$this->setHtml($html); | ||
} | ||
|
||
public function setHtml($html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of having a setter if we're using the constructor already?.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point- I was trying to follow the pattern in lib/helpers/mail/Mail.php but you're right, it's not necessary. Will remove.
lib/helpers/contacts/Recipients.php
Outdated
{ | ||
public $html; | ||
|
||
public function __construct($url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a doc block at least to know what is the type of this parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea- will do.
lib/helpers/contacts/Recipients.php
Outdated
$this->setEmail($email); | ||
} | ||
|
||
public function setFirstName($firstName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as above, if we're using the constructor to set the properties, what's the point of having setters?.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
lib/helpers/contacts/Recipients.php
Outdated
|
||
class RecipientForm | ||
{ | ||
public $html; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are the properties public?, we're breaking OOP encapsulation doing this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will change.
{ | ||
public function testRecipientsForm() | ||
{ | ||
$form = new RecipientForm('http://www.examle.com/recipientFormSubmit'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would make much more sense if we could cast this object to string to have a representation of RecipientForm
in string, e.g:
(string) new RecipientForm('http://www.examle.com/recipientFormSubmit');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense- will do.
lib/helpers/contacts/Recipients.php
Outdated
*/ | ||
class Recipient implements \JsonSerializable | ||
{ | ||
public $firstName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as above for the public properties, doing this breaks OOP ecapsulation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix.
Thanks for the feedback @shonjord - I have addressed them in dfce02a. Let me know if the fixes are adequate. |
@thinkingserious could I get some feedback on this PR? Is this what you were looking for in #454 ? |
We have not been able to merge your Pull Request, but because you are awesome - we wanted to make sure you could still get a SendGrid Hacktoberfest shirt. Please go fill out our swag form before Nov 5th and we will send the shirt! (We know that you might have tried this before and it didn’t work, sorry about that!) You have till Nov 5th to fill out this form in order to get the Hacktoberfest shirt!Thank you for contributing during Hacktoberfest! We hope to see you in the repos soon! Just so you know, we always give away a SendGrid shirt for your first ever non-Hacktoberfest PR that gets merged. |
Hello @kraigh, |
Solves #454
Added a new "Recipients" helper that can do two things:
I included code in the examples directory, as well as unit tests.
A helper for "lists" should also probably be created, showing how to add a created recipient to a list.
First time contributor- so please let me know if I named anything inappropriately, or if there is a way to improve this implementation! I tried to copy patterns from the "Mail" helper as much as possible.