本文整理汇总了PHP中Swift_DependencyContainer::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Swift_DependencyContainer::getInstance方法的具体用法?PHP Swift_DependencyContainer::getInstance怎么用?PHP Swift_DependencyContainer::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Swift_DependencyContainer
的用法示例。
在下文中一共展示了Swift_DependencyContainer::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: email
/**
* Checks if an email matches the current grammars
* @param string $email
*/
public static function email($email)
{
if (self::$grammar === null) {
self::$grammar = Swift_DependencyContainer::getInstance()->lookup('mime.grammar');
}
return preg_match('/^' . self::$grammar->getDefinition('addr-spec') . '$/D', $email);
}
示例2: __construct
/**
* Create a new SmtpTransport, optionally with $host, $port and $security.
*
* @param string $host
* @param integer $port
* @param string $security
*/
public function __construct($host = 'localhost', $port = 25, $security = null)
{
call_user_func_array(array($this, 'Swift_Transport_EsmtpTransport::__construct'), Swift_DependencyContainer::getInstance()->createDependenciesFor('transport.smtp'));
$this->setHost($host);
$this->setPort($port);
$this->setEncryption($security);
}
示例3: __construct
/**
* Create a new NullTransport.
*/
public function __construct()
{
call_user_func_array(
array($this, 'Swift_Transport_NullTransport::__construct'),
Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.null')
);
}
示例4: __construct
/**
* Create a new AWSTransport.
* @param string $AWSAccessKeyId Your access key.
* @param string $AWSSecretKey Your secret key.
* @param boolean $debug Set to true to enable debug messages in error log.
* @param string $endpoint The AWS endpoint to use.
*/
public function __construct($AWSAccessKeyId = null, $AWSSecretKey = null, $debug = false, $endpoint = 'https://email.us-east-1.amazonaws.com/')
{
call_user_func_array(array($this, 'Swift_Transport_AWSTransport::__construct'), Swift_DependencyContainer::getInstance()->createDependenciesFor('transport.aws'));
$this->AWSAccessKeyId = $AWSAccessKeyId;
$this->AWSSecretKey = $AWSSecretKey;
$this->endpoint = $endpoint;
$this->debug = $debug;
}
示例5: __construct
/**
* Create a new EmbeddedFile.
* Details may be optionally provided to the constructor.
* @param string|Swift_OutputByteStream $data
* @param string $filename
* @param string $contentType
*/
public function __construct($data = NULL, $filename = NULL, $contentType = NULL)
{
call_user_func_array(array($this, 'Swift_Mime_EmbeddedFile::__construct'), Swift_DependencyContainer::getInstance()->createDependenciesFor('mime.embeddedfile'));
$this->setBody($data);
$this->setFilename($filename);
if ($contentType) {
$this->setContentType($contentType);
}
}
示例6: __construct
/**
* Create a new Attachment.
*
* Details may be optionally provided to the constructor.
*
* @param string|Swift_OutputByteStream $data
* @param string $filename
* @param string $contentType
*/
public function __construct($data = null, $filename = null, $contentType = null)
{
call_user_func_array(array($this, 'Swift_Mime_Attachment::__construct'), Swift_DependencyContainer::getInstance()->createDependenciesFor('mime.attachment'));
$this->setBody($data);
$this->setFilename($filename);
if ($contentType) {
$this->setContentType($contentType);
}
}
示例7: __construct
/**
* Create a new SendmailTransport, optionally using $command for sending.
* @param string $command
*/
public function __construct($command = '/usr/sbin/sendmail -bs')
{
call_user_func_array(
array($this, 'Swift_Transport_SendmailTransport::__construct'),
Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.sendmail')
);
$this->setCommand($command);
}
示例8: __construct
/**
* Create a new MailTransport, optionally specifying $extraParams.
* @param string $extraParams
*/
public function __construct($extraParams = '-f%s')
{
call_user_func_array(
array($this, 'Swift_Transport_MailTransport::__construct'),
Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.mail')
);
$this->setExtraParams($extraParams);
}
示例9: __construct
/**
* Creates a new FailoverTransport with $transports.
* @param array $transports
*/
public function __construct($transports = array())
{
call_user_func_array(
array($this, 'Swift_Transport_FailoverTransport::__construct'),
Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.failover')
);
$this->setTransports($transports);
}
示例10: testNoLookupsFail
public function testNoLookupsFail()
{
$di = Swift_DependencyContainer::getInstance();
foreach ($di->listItems() as $itemName) {
try {
$di->lookup($itemName);
} catch (Swift_DependencyException $e) {
$this->fail($e->getMessage());
}
}
}
示例11: __construct
/**
* Create a new MimePart.
*
* Details may be optionally passed into the constructor.
*
* @param string $body
* @param string $contentType
* @param string $charset
*/
public function __construct($body = null, $contentType = null, $charset = null)
{
call_user_func_array(array($this, 'Swift_Mime_MimePart::__construct'), Swift_DependencyContainer::getInstance()->createDependenciesFor('mime.part'));
if (!isset($charset)) {
$charset = Swift_DependencyContainer::getInstance()->lookup('properties.charset');
}
$this->setBody($body);
$this->setCharset($charset);
if ($contentType) {
$this->setContentType($contentType);
}
}
示例12: __construct
/**
* Create a new SpoolTransport.
* @param Swift_Spool $spool
*/
public function __construct(Swift_Spool $spool)
{
$arguments = Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.spool');
$arguments[] = $spool;
call_user_func_array(
array($this, 'Swift_Transport_SpoolTransport::__construct'),
$arguments
);
}
示例13: __construct
/**
* Create a new Message.
* Details may be optionally passed into the constructor.
* @param string $subject
* @param string $body
* @param string $contentType
* @param string $charset
*/
public function __construct($subject = NULL, $body = NULL, $contentType = NULL, $charset = NULL)
{
call_user_func_array(array($this, 'Swift_Mime_SimpleMessage::__construct'), Swift_DependencyContainer::getInstance()->createDependenciesFor('mime.message'));
if (!isset($charset)) {
$charset = Swift_DependencyContainer::getInstance()->lookup('properties.charset');
}
$this->setSubject($subject);
$this->setBody($body);
$this->setCharset($charset);
if ($contentType) {
$this->setContentType($contentType);
}
}
示例14: __construct
/**
* Swift初期化
*
* @param String $host
* @param String $port
* @param String $user
* @param String $pass
* @param String $charset
* @return vold
* @codeCoverageIgnore
*/
public function __construct($host, $port, $user, $pass, $charset = 'iso-2022-jp')
{
$this->host = $host;
$this->port = $port;
$this->user = $user;
$this->pass = $pass;
$this->charset = $charset;
$this->setPath();
\Swift::init(function () use($charset) {
\Swift_DependencyContainer::getInstance()->register('mime.qpheaderencoder')->asAliasOf('mime.base64headerencoder');
\Swift_Preferences::getInstance()->setCharset($charset);
});
}
示例15: prepare
/**
* Выполняется перед каждым запросом браузера
*
* @return void
*/
public function prepare()
{
// Инициализировать директории
$this->_mailDir = $this->_initDir('app_mail_save_dir');
$this->_templateDir = $this->_initDir('app_mail_template_dir', $create = false);
// Очистить директорию с письмами
$this->reset();
// Обработчик писем
$this->_invoker = new myMailInvokerSave($this->_mailDir);
Swift_DependencyContainer::getInstance()->register('transport.mailinvoker')->asValue($this->_invoker);
// Указать ошибочные email
if ($this->_errors) {
$this->_invoker->setErrors($this->_errors);
$this->_errors = null;
}
}