TYPO3 API  SVNRelease
HitReporter.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  * This file is part of SwiftMailer.
00005  * (c) 2004-2009 Chris Corbyn
00006  *
00007  * For the full copyright and license information, please view the LICENSE
00008  * file that was distributed with this source code.
00009  */
00010 
00011 //@require 'Swift/Plugins/Reporter.php';
00012 //@require 'Swift/Mime/Message.php';
00013 
00014 /**
00015  * A reporter which "collects" failures for the Reporter plugin.
00016  * @package Swift
00017  * @subpackage Plugins
00018  * @author Chris Corbyn
00019  */
00020 class Swift_Plugins_Reporters_HitReporter implements Swift_Plugins_Reporter
00021 {
00022 
00023   /**
00024    * The list of failures.
00025    * @var array
00026    * @access private
00027    */
00028   private $_failures = array();
00029   private $_failures_cache = array();
00030 
00031   /**
00032    * Notifies this ReportNotifier that $address failed or succeeded.
00033    * @param Swift_Mime_Message $message
00034    * @param string $address
00035    * @param int $result from {@link RESULT_PASS, RESULT_FAIL}
00036    */
00037   public function notify(Swift_Mime_Message $message, $address, $result)
00038   {
00039     if (self::RESULT_FAIL == $result && !isset($this->_failures_cache[$address]))
00040     {
00041       $this->_failures[] = $address;
00042       $this->_failures_cache[$address] = true;
00043     }
00044   }
00045 
00046   /**
00047    * Get an array of addresses for which delivery failed.
00048    * @return array
00049    */
00050   public function getFailedRecipients()
00051   {
00052     return $this->_failures;
00053   }
00054 
00055   /**
00056    * Clear the buffer (empty the list).
00057    */
00058   public function clear()
00059   {
00060     $this->_failures = $this->_failures_cache = array();
00061   }
00062 
00063 }