forked from laminas/laminas-mail
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging develop to master in preparation for 2.12.0 release.
- Loading branch information
Showing
21 changed files
with
574 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.