/framework/vendor/swift/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php

http://zoop.googlecode.com/ · PHP · 47 lines · 21 code · 5 blank · 21 comment · 2 complexity · 609c7fac7ae91cf6135d70c7cab23b19 MD5 · raw file

  1. <?php
  2. /*
  3. * This file is part of SwiftMailer.
  4. * (c) 2004-2009 Chris Corbyn
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. //@require 'Swift/Plugins/Reporter.php';
  10. //@require 'Swift/Mime/Message.php';
  11. /**
  12. * A HTML output reporter for the Reporter plugin.
  13. * @package Swift
  14. * @subpackage Plugins
  15. * @author Chris Corbyn
  16. */
  17. class Swift_Plugins_Reporters_HtmlReporter implements Swift_Plugins_Reporter
  18. {
  19. /**
  20. * Notifies this ReportNotifier that $address failed or succeeded.
  21. * @param Swift_Mime_Message $message
  22. * @param string $address
  23. * @param int $result from {@link RESULT_PASS, RESULT_FAIL}
  24. */
  25. public function notify(Swift_Mime_Message $message, $address, $result)
  26. {
  27. if (self::RESULT_PASS == $result)
  28. {
  29. echo "<div style=\"color: #fff; background: #006600; padding: 2px; margin: 2px;\">" . PHP_EOL;
  30. echo "PASS " . $address . PHP_EOL;
  31. echo "</div>" . PHP_EOL;
  32. flush();
  33. }
  34. else
  35. {
  36. echo "<div style=\"color: #fff; background: #880000; padding: 2px; margin: 2px;\">" . PHP_EOL;
  37. echo "FAIL " . $address . PHP_EOL;
  38. echo "</div>" . PHP_EOL;
  39. flush();
  40. }
  41. }
  42. }