Вход Регистрация
Файл: concrete5.7.5.6/concrete/vendor/zendframework/zend-mail/src/Protocol/SmtpPluginManager.php
Строк: 86
<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace ZendMailProtocol;

use 
ZendServiceManagerAbstractPluginManager;

/**
 * Plugin manager implementation for SMTP extensions.
 *
 * Enforces that SMTP extensions retrieved are instances of Smtp. Additionally,
 * it registers a number of default extensions available.
 */
class SmtpPluginManager extends AbstractPluginManager
{
    
/**
     * Default set of extensions
     *
     * @var array
     */
    
protected $invokableClasses = array(
        
'crammd5' => 'ZendMailProtocolSmtpAuthCrammd5',
        
'login'   => 'ZendMailProtocolSmtpAuthLogin',
        
'plain'   => 'ZendMailProtocolSmtpAuthPlain',
        
'smtp'    => 'ZendMailProtocolSmtp',
    );

    
/**
     * Validate the plugin
     *
     * Checks that the extension loaded is an instance of Smtp.
     *
     * @param  mixed $plugin
     * @return void
     * @throws ExceptionInvalidArgumentException if invalid
     */
    
public function validatePlugin($plugin)
    {
        if (
$plugin instanceof Smtp) {
            
// we're okay
            
return;
        }

        throw new 
ExceptionInvalidArgumentException(sprintf(
            
'Plugin of type %s is invalid; must extend %sSmtp',
            (
is_object($plugin) ? get_class($plugin) : gettype($plugin)),
            
__NAMESPACE__
        
));
    }
}
Онлайн: 1
Реклама