Commit 0fe37e99 authored by Adam Shepherd's avatar Adam Shepherd
Browse files

Issue #3274069 by AdamPS: Add interfaces

parent 556380e8
Loading
Loading
Loading
Loading
+4 −4
Changes for modules/symfony_mailer_bc/src/MailManagerReplacement.php: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\Core\Mail\MailManager;
use Drupal\Core\Render\RendererInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\symfony_mailer\EmailFactory;
use Drupal\symfony_mailer\EmailFactoryInterface;
use Drupal\symfony_mailer\EmailInterface;
use Drupal\symfony_mailer\MailerHelperInterface;

@@ -35,7 +35,7 @@ class MailManagerReplacement extends MailManager {
  /**
   * The email factory.
   *
   * @var \Drupal\symfony_mailer\EmailFactory
   * @var \Drupal\symfony_mailer\EmailFactoryInterface
   */
  protected $emailFactory;

@@ -64,12 +64,12 @@ class MailManagerReplacement extends MailManager {
   *   The string translation service.
   * @param \Drupal\Core\Render\RendererInterface $renderer
   *   The renderer.
   * @param \Drupal\symfony_mailer\EmailFactory $email_factory;
   * @param \Drupal\symfony_mailer\EmailFactoryInterface $email_factory;
   *   The email factory.
   * @param \Drupal\symfony_mailer\MailerHelperInterface $mailer_helper
   *   The mailer helper.
   */
  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, ConfigFactoryInterface $config_factory, LoggerChannelFactoryInterface $logger_factory, TranslationInterface $string_translation, RendererInterface $renderer, EmailFactory $email_factory, MailerHelperInterface $mailer_helper) {
  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, ConfigFactoryInterface $config_factory, LoggerChannelFactoryInterface $logger_factory, TranslationInterface $string_translation, RendererInterface $renderer, EmailFactoryInterface $email_factory, MailerHelperInterface $mailer_helper) {
    parent::__construct($namespaces, $cache_backend, $module_handler, $config_factory, $logger_factory, $string_translation, $renderer);
    $this->emailFactory = $email_factory;
    $this->mailerHelper = $mailer_helper;
+1 −1
Changes for src/EmailFactory.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ use Drupal\symfony_mailer\Processor\EmailBuilderManagerInterface;
/**
 * Provides a factory for creating email objects.
 */
class EmailFactory {
class EmailFactory implements EmailFactoryInterface {

  /**
   * The email builder manager.
+38 −0
Changes for src/EmailFactoryInterface.php: 38 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace Drupal\symfony_mailer;

use Drupal\Core\Config\Entity\ConfigEntityInterface;

/**
 * Provides an interface for the Email Factory.
 */
interface EmailFactoryInterface {

  /**
   * Creates an email object unrelated to a config entity.
   *
   * @param string $module
   *   The module name.
   * @param string $sub_type
   *   Sub-type. @see \Drupal\symfony_mailer\EmailInterface::getSubType()
   *
   * @return \Drupal\symfony_mailer\EmailInterface
   *   A new email object.
   */
  public function newModuleEmail(string $module, string $sub_type);

  /**
   * Creates an email object from a config entity.
   *
   * @param \Drupal\Core\Config\Entity\ConfigEntityInterface $entity
   *   Entity. @see \Drupal\symfony_mailer\EmailInterface::getEntity()
   * @param string $sub_type
   *   Sub-type. @see \Drupal\symfony_mailer\EmailInterface::getSubType()
   *
   * @return \Drupal\symfony_mailer\EmailInterface
   *   A new email object.
   */
  public function newEntityEmail(ConfigEntityInterface $entity, string $sub_type);

}