Mail
extends AbstractWriter
in package
Mail log writer class
Tags
Table of Contents
Properties
- $emails : array<string|int, mixed>
- Emails to which to send the log messages
- $limit : string|null
- Log limit, stored as the canonical PSR-3 level string
- $mailer : Mailer|null
- Mailer object
- $options : array<string|int, mixed>
- Array of mail-specific options, i.e. subject, headers, etc.
Methods
- __construct() : mixed
- Constructor
- addEmails() : Mail
- Add emails
- addOption() : Mail
- Add option
- addOptions() : Mail
- Add options
- getContext() : string
- Get context for log
- getEmails() : array<string|int, mixed>
- Get emails
- getLogLimit() : string|null
- Get log limit
- getMailer() : Mailer
- Get mailer
- getOptions() : array<string|int, mixed>
- Get options
- hasLogLimit() : bool
- Has log limit
- isWithinLogLimit() : bool
- Check if a log level is within the set log level limit
- setEmails() : Mail
- Set emails
- setLogLimit() : AbstractWriter
- Set log limit
- setOptions() : Mail
- Set options
- writeLog() : Mail
- Write to the log
- sanitize() : string
- Strip CR/LF from a value before it's written into a delimited/line-based log format, to prevent an embedded newline from forging a fake extra line (or, for writers that build header-style text like Mail's Subject line, a fake extra header).
Properties
$emails
Emails to which to send the log messages
protected
array<string|int, mixed>
$emails
= []
$limit
Log limit, stored as the canonical PSR-3 level string
protected
string|null
$limit
= null
$mailer
Mailer object
protected
Mailer|null
$mailer
= null
$options
Array of mail-specific options, i.e. subject, headers, etc.
protected
array<string|int, mixed>
$options
= []
Methods
__construct()
Constructor
public
__construct(Mailer $mailer, mixed $emails[, array<string|int, mixed> $options = [] ]) : mixed
Instantiate the Mail writer object
Parameters
- $mailer : Mailer
- $emails : mixed
- $options : array<string|int, mixed> = []
addEmails()
Add emails
public
addEmails(mixed $emails) : Mail
Parameters
- $emails : mixed
Return values
MailaddOption()
Add option
public
addOption(mixed $option, mixed $value) : Mail
Parameters
- $option : mixed
- $value : mixed
Return values
MailaddOptions()
Add options
public
addOptions(array<string|int, mixed> $options) : Mail
Parameters
- $options : array<string|int, mixed>
Return values
MailgetContext()
Get context for log
public
getContext([array<string|int, mixed> $context = [] ]) : string
Parameters
- $context : array<string|int, mixed> = []
Return values
stringgetEmails()
Get emails
public
getEmails() : array<string|int, mixed>
Return values
array<string|int, mixed>getLogLimit()
Get log limit
public
getLogLimit() : string|null
Return values
string|nullgetMailer()
Get mailer
public
getMailer() : Mailer
Return values
MailergetOptions()
Get options
public
getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>hasLogLimit()
Has log limit
public
hasLogLimit() : bool
Return values
boolisWithinLogLimit()
Check if a log level is within the set log level limit
public
isWithinLogLimit(string|int $level) : bool
Parameters
- $level : string|int
Return values
boolsetEmails()
Set emails
public
setEmails(mixed $emails) : Mail
Parameters
- $emails : mixed
Return values
MailsetLogLimit()
Set log limit
public
setLogLimit(string|int $level) : AbstractWriter
Accepts either a PSR-3 level string or a legacy severity int (0-7) for backward compatibility; always normalized and stored as the canonical PSR-3 string.
Parameters
- $level : string|int
Return values
AbstractWritersetOptions()
Set options
public
setOptions(array<string|int, mixed> $options) : Mail
Parameters
- $options : array<string|int, mixed>
Return values
MailwriteLog()
Write to the log
public
writeLog(string $level, string $message[, array<string|int, mixed> $context = [] ]) : Mail
Parameters
- $level : string
- $message : string
- $context : array<string|int, mixed> = []
Return values
Mailsanitize()
Strip CR/LF from a value before it's written into a delimited/line-based log format, to prevent an embedded newline from forging a fake extra line (or, for writers that build header-style text like Mail's Subject line, a fake extra header).
protected
sanitize(string $value) : string
Parameters
- $value : string