PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/framework/vendor/swift/lib/classes/Swift/Events/SendEvent.php

http://zoop.googlecode.com/
PHP | 127 lines | 43 code | 19 blank | 65 comment | 0 complexity | 3bd94b6f639b2ec5490542595165607e MD5 | raw file
  1<?php
  2
  3/*
  4 * This file is part of SwiftMailer.
  5 * (c) 2004-2009 Chris Corbyn
  6 *
  7 * For the full copyright and license information, please view the LICENSE
  8 * file that was distributed with this source code.
  9 */
 10
 11//@require 'Swift/Events/EventObject.php';
 12
 13/**
 14 * Generated when a message is being sent.
 15 * @package Swift
 16 * @subpackage Events
 17 * @author Chris Corbyn
 18 */
 19class Swift_Events_SendEvent extends Swift_Events_EventObject
 20{
 21  
 22  /** Sending has yet to occur */
 23  const RESULT_PENDING = 0x0001;
 24  
 25  /** Sending was successful */
 26  const RESULT_SUCCESS = 0x0010;
 27  
 28  /** Sending worked, but there were some failures */
 29  const RESULT_TENTATIVE = 0x0100;
 30  
 31  /** Sending failed */
 32  const RESULT_FAILED = 0x1000;
 33  
 34  /**
 35   * The Message being sent.
 36   * @var Swift_Mime_Message
 37   */
 38  private $_message;
 39  
 40  /**
 41   * The Transport used in sending.
 42   * @var Swift_Transport
 43   */
 44  private $_transport;
 45  
 46  /**
 47   * Any recipients which failed after sending.
 48   * @var string[]
 49   */
 50  private $failedRecipients = array();
 51  
 52  /**
 53   * The overall result as a bitmask from the class constants.
 54   * @var int
 55   */
 56  private $result;
 57  
 58  /**
 59   * Create a new SendEvent for $source and $message.
 60   * @param Swift_Transport $source
 61   * @param Swift_Mime_Message $message
 62   */
 63  public function __construct(Swift_Transport $source,
 64    Swift_Mime_Message $message)
 65  {
 66    parent::__construct($source);
 67    $this->_message = $message;
 68    $this->_result = self::RESULT_PENDING;
 69  }
 70  
 71  /**
 72   * Get the Transport used to send the Message.
 73   * @return Swift_Transport
 74   */
 75  public function getTransport()
 76  {
 77    return $this->getSource();
 78  }
 79  
 80  /**
 81   * Get the Message being sent.
 82   * @return Swift_Mime_Message
 83   */
 84  public function getMessage()
 85  {
 86    return $this->_message;
 87  }
 88  
 89  /**
 90   * Set the array of addresses that failed in sending.
 91   * @param array $recipients
 92   */
 93  public function setFailedRecipients($recipients)
 94  {
 95    $this->_failedRecipients = $recipients;
 96  }
 97  
 98  /**
 99   * Get an recipient addresses which were not accepted for delivery.
100   * @return string[]
101   */
102  public function getFailedRecipients()
103  {
104    return $this->_failedRecipients;
105  }
106  
107  /**
108   * Set the result of sending.
109   * @return int
110   */
111  public function setResult($result)
112  {
113    $this->_result = $result;
114  }
115  
116  /**
117   * Get the result of this Event.
118   * The return value is a bitmask from
119   * {@link RESULT_PENDING, RESULT_SUCCESS, RESULT_TENTATIVE, RESULT_FAILED}
120   * @return int
121   */
122  public function getResult()
123  {
124    return $this->_result;
125  }
126  
127}