mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 07:12:26 +02:00
N°5102 - Allow to send emails (eg. notifications) using GSuite SMTP and OAuth
* migration to iTop 3.0
This commit is contained in:
75
lib/laminas/laminas-mail/src/Header/HeaderLocator.php
Normal file
75
lib/laminas/laminas-mail/src/Header/HeaderLocator.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @see https://github.com/laminas/laminas-mail for the canonical source repository
|
||||
* @copyright https://github.com/laminas/laminas-mail/blob/master/COPYRIGHT.md
|
||||
* @license https://github.com/laminas/laminas-mail/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Mail\Header;
|
||||
|
||||
/**
|
||||
* Plugin Class Loader implementation for HTTP headers
|
||||
*/
|
||||
final class HeaderLocator implements HeaderLocatorInterface
|
||||
{
|
||||
/**
|
||||
* @var array Pre-aliased Header plugins
|
||||
*/
|
||||
private $plugins = [
|
||||
'bcc' => Bcc::class,
|
||||
'cc' => Cc::class,
|
||||
'contentdisposition' => ContentDisposition::class,
|
||||
'content_disposition' => ContentDisposition::class,
|
||||
'content-disposition' => ContentDisposition::class,
|
||||
'contenttype' => ContentType::class,
|
||||
'content_type' => ContentType::class,
|
||||
'content-type' => ContentType::class,
|
||||
'contenttransferencoding' => ContentTransferEncoding::class,
|
||||
'content_transfer_encoding' => ContentTransferEncoding::class,
|
||||
'content-transfer-encoding' => ContentTransferEncoding::class,
|
||||
'date' => Date::class,
|
||||
'from' => From::class,
|
||||
'in-reply-to' => InReplyTo::class,
|
||||
'message-id' => MessageId::class,
|
||||
'mimeversion' => MimeVersion::class,
|
||||
'mime_version' => MimeVersion::class,
|
||||
'mime-version' => MimeVersion::class,
|
||||
'received' => Received::class,
|
||||
'references' => References::class,
|
||||
'replyto' => ReplyTo::class,
|
||||
'reply_to' => ReplyTo::class,
|
||||
'reply-to' => ReplyTo::class,
|
||||
'sender' => Sender::class,
|
||||
'subject' => Subject::class,
|
||||
'to' => To::class,
|
||||
];
|
||||
|
||||
public function get(string $name, ?string $default = null): ?string
|
||||
{
|
||||
$name = $this->normalizeName($name);
|
||||
return isset($this->plugins[$name]) ? $this->plugins[$name] : $default;
|
||||
}
|
||||
|
||||
public function has(string $name): bool
|
||||
{
|
||||
return isset($this->plugins[$this->normalizeName($name)]);
|
||||
}
|
||||
|
||||
public function add(string $name, string $class): void
|
||||
{
|
||||
$this->plugins[$this->normalizeName($name)] = $class;
|
||||
}
|
||||
|
||||
public function remove(string $name): void
|
||||
{
|
||||
unset($this->plugins[$this->normalizeName($name)]);
|
||||
}
|
||||
|
||||
private function normalizeName(string $name): string
|
||||
{
|
||||
return strtolower($name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @see https://github.com/laminas/laminas-mail for the canonical source repository
|
||||
* @copyright https://github.com/laminas/laminas-mail/blob/master/COPYRIGHT.md
|
||||
* @license https://github.com/laminas/laminas-mail/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Mail\Header;
|
||||
|
||||
/**
|
||||
* Interface detailing how to resolve header names to classes.
|
||||
*/
|
||||
interface HeaderLocatorInterface
|
||||
{
|
||||
public function get(string $name, ?string $default = null): ?string;
|
||||
|
||||
public function has(string $name): bool;
|
||||
|
||||
public function add(string $name, string $class): void;
|
||||
|
||||
public function remove(string $name): void;
|
||||
}
|
||||
Reference in New Issue
Block a user