Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. UnsupportedSchemeException.php

function UnsupportedSchemeException::__construct

File

vendor/symfony/mailer/Exception/UnsupportedSchemeException.php, line 97

Class

UnsupportedSchemeException
@author Konstantin Myakshin <molodchick@gmail.com>

Namespace

Symfony\Component\Mailer\Exception

Code

public function __construct(Dsn $dsn, ?string $name = null, array $supported = []) {
    $provider = $dsn->getScheme();
    if (false !== ($pos = strpos($provider, '+'))) {
        $provider = substr($provider, 0, $pos);
    }
    $package = self::SCHEME_TO_PACKAGE_MAP[$provider] ?? null;
    if ($package && !class_exists($package['class'])) {
        parent::__construct(\sprintf('Unable to send emails via "%s" as the bridge is not installed. Try running "composer require %s".', $provider, $package['package']));
        return;
    }
    $message = \sprintf('The "%s" scheme is not supported', $dsn->getScheme());
    if ($name && $supported) {
        $message .= \sprintf('; supported schemes for mailer "%s" are: "%s"', $name, implode('", "', $supported));
    }
    parent::__construct($message . '.');
}
RSS feed
Powered by Drupal