Skip to content

Commit

Permalink
Change Message sent text to Message spooled if we are in a spool context
Browse files Browse the repository at this point in the history
  • Loading branch information
dator committed Mar 21, 2011
1 parent a505ff4 commit f8dead7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,22 @@
class MessageDataCollector extends DataCollector
{
protected $logger;

protected $mailer;

public function __construct(\Swift_Events_SendListener $logger, \Swift_Mailer $mailer)
{
$this->logger = $logger;
// we do nothing with the mailer
// it's in the constructor just to force SwiftMailer to be initialized
$this->mailer = $mailer;
}

/**
* {@inheritdoc}
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
{
$this->data['messages'] = $this->logger->getMessages();
$this->data['messages'] = $this->logger->getMessages();
$this->data['messageCount'] = $this->logger->countMessages();
$this->data['isSpool'] = $this->mailer->getTransport() instanceof \Swift_Transport_SpoolTransport;
}

public function getMessageCount()
Expand All @@ -50,6 +51,11 @@ public function getMessages()
{
return $this->data['messages'];
}

public function isSpool()
{
return $this->data['isSpool'];
}

/**
* {@inheritdoc}
Expand All @@ -58,4 +64,4 @@ public function getName()
{
return 'swiftmailer';
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{% endblock %}

{% block panel %}
<h2>Messages sent</h2>
<h2>Messages {% if not collector.isSpool %} sent {% else %} spooled {% endif %}</h2>

{% if not collector.messages %}
<p>
Expand Down

0 comments on commit f8dead7

Please sign in to comment.