TransportFactory
    
            
            in package
            
        
    
    
            
            uses
                            StaticConfigTrait                    
    
Factory class for generating email transport instances.
Table of Contents
Properties
- $_config : array<string, mixed>
- Configuration sets.
- $_dsnClassMap : array<string, string>
- An array mapping url schemes to fully qualified Transport class names
- $_registry : TransportRegistry|null
- Transport Registry used for creating and using transport instances.
Methods
- configured() : array<string|int, string>
- Returns an array containing the named configurations
- drop() : bool
- Drops a constructed adapter.
- get() : AbstractTransport
- Get transport instance.
- getConfig() : mixed|null
- Reads existing configuration.
- getConfigOrFail() : mixed
- Reads existing configuration for a specific key.
- getDsnClassMap() : array<string, string>
- Returns the DSN class map for this class.
- getRegistry() : TransportRegistry
- Returns the Transport Registry used for creating and using transport instances.
- parseDsn() : array<string, mixed>
- Parses a DSN into a valid connection configuration
- setConfig() : void
- This method can be used to define configuration adapters for an application.
- setDsnClassMap() : void
- Updates the DSN class map for this class.
- setRegistry() : void
- Sets the Transport Registry instance used for creating and using transport instances.
- _buildTransport() : void
- Finds and builds the instance of the required tranport class.
Properties
$_config
Configuration sets.
    protected
    static    array<string, mixed>
    $_config
     = []
    
    
    
    
$_dsnClassMap
An array mapping url schemes to fully qualified Transport class names
    protected
    static    array<string, string>
    $_dsnClassMap
     = ['debug' => \Cake\Mailer\Transport\DebugTransport::class, 'mail' => \Cake\Mailer\Transport\MailTransport::class, 'smtp' => \Cake\Mailer\Transport\SmtpTransport::class]
    
    
    
    Tags
$_registry
Transport Registry used for creating and using transport instances.
    protected
    static    TransportRegistry|null
    $_registry
    
    
    
    
    
Methods
configured()
Returns an array containing the named configurations
    public
            static        configured() : array<string|int, string>
    Return values
array<string|int, string> —Array of configurations.
drop()
Drops a constructed adapter.
    public
            static        drop(string $config) : bool
    If you wish to modify an existing configuration, you should drop it, change configuration and then re-add it.
If the implementing objects supports a $_registry object the named configuration
will also be unloaded from the registry.
Parameters
- $config : string
- 
                    An existing configuration you wish to remove. 
Return values
bool —Success of the removal, returns false when the config does not exist.
get()
Get transport instance.
    public
            static        get(string $name) : AbstractTransport
    Parameters
- $name : string
- 
                    Config name. 
Return values
AbstractTransportgetConfig()
Reads existing configuration.
    public
            static        getConfig(string $key) : mixed|null
    Parameters
- $key : string
- 
                    The name of the configuration. 
Return values
mixed|null —Configuration data at the named key or null if the key does not exist.
getConfigOrFail()
Reads existing configuration for a specific key.
    public
            static        getConfigOrFail(string $key) : mixed
    The config value for this key must exist, it can never be null.
Parameters
- $key : string
- 
                    The name of the configuration. 
Tags
Return values
mixed —Configuration data at the named key.
getDsnClassMap()
Returns the DSN class map for this class.
    public
            static        getDsnClassMap() : array<string, string>
    Tags
Return values
array<string, string>getRegistry()
Returns the Transport Registry used for creating and using transport instances.
    public
            static        getRegistry() : TransportRegistry
    Return values
TransportRegistryparseDsn()
Parses a DSN into a valid connection configuration
    public
            static        parseDsn(string $dsn) : array<string, mixed>
    This method allows setting a DSN using formatting similar to that used by PEAR::DB. The following is an example of its usage:
$dsn = 'mysql://user:pass@localhost/database?';
$config = ConnectionManager::parseDsn($dsn);
$dsn = 'Cake\Log\Engine\FileLog://?types=notice,info,debug&file=debug&path=LOGS';
$config = Log::parseDsn($dsn);
$dsn = 'smtp://user:secret@localhost:25?timeout=30&client=null&tls=null';
$config = Email::parseDsn($dsn);
$dsn = 'file:///?className=\My\Cache\Engine\FileEngine';
$config = Cache::parseDsn($dsn);
$dsn = 'File://?prefix=myapp_cake_core_&serialize=true&duration=+2 minutes&path=/tmp/persistent/';
$config = Cache::parseDsn($dsn);
For all classes, the value of scheme is set as the value of both the className
unless they have been otherwise specified.
Note that querystring arguments are also parsed and set as values in the returned configuration.
Parameters
- $dsn : string
- 
                    The DSN string to convert to a configuration array 
Tags
Return values
array<string, mixed> —The configuration array to be stored after parsing the DSN
setConfig()
This method can be used to define configuration adapters for an application.
    public
            static        setConfig(array<string, mixed>|string $key[, mixed $config = null ]) : void
    To change an adapter's configuration at runtime, first drop the adapter and then reconfigure it.
Adapters will not be constructed until the first operation is done.
Usage
Assuming that the class' name is Cache the following scenarios
are supported:
Setting a cache engine up.
Cache::setConfig('default', $settings);
Injecting a constructed adapter in:
Cache::setConfig('default', $instance);
Configure multiple adapters at once:
Cache::setConfig($arrayOfConfig);
Parameters
- $key : array<string, mixed>|string
- 
                    The name of the configuration, or an array of multiple configs. 
- $config : mixed = null
- 
                    Configuration value. Generally an array of name => configuration data for adapter. 
Tags
setDsnClassMap()
Updates the DSN class map for this class.
    public
            static        setDsnClassMap(array<string, string> $map) : void
    Parameters
- $map : array<string, string>
- 
                    Additions/edits to the class map to apply. 
Tags
setRegistry()
Sets the Transport Registry instance used for creating and using transport instances.
    public
            static        setRegistry(TransportRegistry $registry) : void
    Also allows for injecting of a new registry instance.
Parameters
- $registry : TransportRegistry
- 
                    Injectable registry object. 
_buildTransport()
Finds and builds the instance of the required tranport class.
    protected
            static        _buildTransport(string $name) : void
    Parameters
- $name : string
- 
                    Name of the config array that needs a tranport instance built