Issue #2023357 by Gábor Hojtsy: Missing floating point number type support in config...
[project/drupal.git] / core / lib / Drupal / Core / Mail / VariableLog.php
1 <?php
2
3 /**
4 * @file
5 * Definition of Drupal\Core\Mail\VariableLog.
6 */
7
8 namespace Drupal\Core\Mail;
9
10 /**
11 * Defines a mail sending implementation that captures sent messages to a
12 * variable.
13 *
14 * This class is for running tests or for development.
15 */
16 class VariableLog extends PhpMail implements MailInterface {
17
18 /**
19 * Overrides Drupal\Core\Mail\PhpMail::mail().
20 *
21 * Accepts an e-mail message and store it in a variable.
22 */
23 public function mail(array $message) {
24 $captured_emails = \Drupal::state()->get('system.test_email_collector') ?: array();
25 $captured_emails[] = $message;
26 \Drupal::state()->set('system.test_email_collector', $captured_emails);
27
28 return TRUE;
29 }
30 }