GenericHelper extends AbstractHelper
Provides common Message helper routines for Message manipulation.
Tags
Table of Contents
- $mimePartFactory : MimePartFactory
 - $partBuilderFactory : PartBuilderFactory
 - $uuEncodedPartFactory : UUEncodedPartFactory
 - $contentHeaders : array<string|int, string>
 - __construct() : mixed
 - Constructor
 - copyContentHeadersAndContent() : mixed
 - Copies Content-* headers (permanent ones as defined in https://tools.ietf.org/html/rfc4021#section-2.2) from the $from header into the $to header. If the Content-Type header isn't defined in $from, defaults to text/plain with utf-8 and quoted-printable.
 - copyHeader() : mixed
 - Copies the passed $header from $from, to $to or sets the header to $default if it doesn't exist in $from.
 - createNewContentPartFrom() : MimePart
 - Creates a new content part from the passed part, allowing the part to be used for something else (e.g. changing a non-mime message to a multipart mime message).
 - movePartContentAndChildren() : mixed
 - Copies type headers (Content-Type, Content-Disposition, Content-Transfer-Encoding) from the $from MimePart to $to. Attaches the content resource handle of $from to $to, and loops over child parts, removing them from $from and adding them to $to.
 - removeContentHeadersAndContent() : mixed
 - Removes Content-* headers (permanent ones as defined in https://tools.ietf.org/html/rfc4021#section-2.2) from the passed part, then detaches its content stream.
 - replacePart() : mixed
 - Replaces the $part ParentHeaderPart with $replacement.
 
Properties
$mimePartFactory
    protected
        MimePartFactory
    $mimePartFactory
    
        
    
$partBuilderFactory
    protected
        PartBuilderFactory
    $partBuilderFactory
    
        
    
$uuEncodedPartFactory
    protected
        UUEncodedPartFactory
    $uuEncodedPartFactory
    
        
    
$contentHeaders
    private
    static    array<string|int, string>
    $contentHeaders
     = ['Content-Type', 'Content-Transfer-Encoding', 'Content-Disposition', 'Content-ID', 'Content-Description', 'Content-Language', 'Content-Base', 'Content-Location', 'Content-features', 'Content-Alternative', 'Content-MD5', 'Content-Duration']
        
    
Methods
__construct()
Constructor
    public
                __construct(MimePartFactory $mimePartFactory, UUEncodedPartFactory $uuEncodedPartFactory, PartBuilderFactory $partBuilderFactory) : mixed
        
        Parameters
- $mimePartFactory : MimePartFactory
 - $uuEncodedPartFactory : UUEncodedPartFactory
 - $partBuilderFactory : PartBuilderFactory
 
Return values
mixed —copyContentHeadersAndContent()
Copies Content-* headers (permanent ones as defined in https://tools.ietf.org/html/rfc4021#section-2.2) from the $from header into the $to header. If the Content-Type header isn't defined in $from, defaults to text/plain with utf-8 and quoted-printable.
    public
                copyContentHeadersAndContent(ParentHeaderPart $from, ParentHeaderPart $to[, bool $move = false ]) : mixed
        
        Parameters
- $from : ParentHeaderPart
 - $to : ParentHeaderPart
 - $move : bool = false
 
Return values
mixed —copyHeader()
Copies the passed $header from $from, to $to or sets the header to $default if it doesn't exist in $from.
    public
                copyHeader(ParentHeaderPart $from, ParentHeaderPart $to, string $header[, string $default = null ]) : mixed
        
        Parameters
- $from : ParentHeaderPart
 - $to : ParentHeaderPart
 - $header : string
 - $default : string = null
 
Return values
mixed —createNewContentPartFrom()
Creates a new content part from the passed part, allowing the part to be used for something else (e.g. changing a non-mime message to a multipart mime message).
    public
                createNewContentPartFrom(ParentHeaderPart $part) : MimePart
        
        Parameters
- $part : ParentHeaderPart
 
Return values
MimePart —the newly-created MimePart
movePartContentAndChildren()
Copies type headers (Content-Type, Content-Disposition, Content-Transfer-Encoding) from the $from MimePart to $to. Attaches the content resource handle of $from to $to, and loops over child parts, removing them from $from and adding them to $to.
    public
                movePartContentAndChildren(ParentHeaderPart $from, ParentHeaderPart $to) : mixed
        
        Parameters
- $from : ParentHeaderPart
 - $to : ParentHeaderPart
 
Return values
mixed —removeContentHeadersAndContent()
Removes Content-* headers (permanent ones as defined in https://tools.ietf.org/html/rfc4021#section-2.2) from the passed part, then detaches its content stream.
    public
                removeContentHeadersAndContent(ParentHeaderPart $part) : mixed
        
        Parameters
- $part : ParentHeaderPart
 
Return values
mixed —replacePart()
Replaces the $part ParentHeaderPart with $replacement.
    public
                replacePart(Message $message, ParentHeaderPart $part, ParentHeaderPart $replacement) : mixed
        Essentially removes $part from its parent, and adds $replacement in its same position. If $part is this Message, then $part can't be removed and replaced, and instead $replacement's type headers are copied to $message, and any children below $replacement are added directly below $message.
Parameters
- $message : Message
 - $part : ParentHeaderPart
 - $replacement : ParentHeaderPart