[Network] [Mail] Added reset() function to make the class reentrant

Review Request #234 — Created Nov. 1, 2013 and submitted

andrea
Lunr
unit_refactoring_mail
214
lunr
A reset function is added and called at the end of send(), in order to clean up the state of the Object without destroying it.
Also added sendTo($index) method, which will send the email just to one of the addresses added, specified in the $index var.
This could prove useful in some occasions.
Unit Tests.
  • 0
  • 0
  • 2
  • 0
  • 2
Description From Last Updated
pprkut
  1. 
      
  2. src/Lunr/Network/Mail.php (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    I fail to see the benefit of
    
    $mail->from(me)->sendTo(you);
    
    over
    
    $mail->from(me)->add_to(you)->send();
    
    We get a bunch of added complexity for 8 characters less to type.
    1. Thanks, I was aware, but that's not what is for. (I'm not gonna copypaste from Skype)
      Will remove it of course, not going into which solution would be best for my case and the harm of providing both options.
    2. Well, then you need to document it better. Based on the documentation of the method, this is *exactly* what I would use it for.
    3. Ok, rechecking to code, I see what use case you see in it. Functionality like this is in fact planned to be available, in different form however.
      The idea is to provide an implementation for something like this within Vortex, aka email notifications.
  3. src/Lunr/Network/Tests/MailSetTest.php (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    what exactly are you testing here?
    1. Yeah, nothing. Forget to initialize with something and call reset at the end.
  4. 
      
andrea
andrea
dinos
  1. Ship It!
  2. 
      
andrea
Review request changed

Status: Closed (submitted)

Change Summary:

Merged slightly adjusted version into master
Loading...