public static function getAgent($name, array $options = [])
    {
        if (!self::hasAgent($name)) {
            $scheme = self::scheme($name);
            $config = self::config($name);
            if (is_array($scheme) && empty($options)) {
                $options = self::parseScheme($scheme);
            }
            if (isset($options['scheme'])) {
                unset($options['scheme']);
            }
            $className = "Toplan\\PhpSms\\{$name}Agent";
            if (isset($options['agentClass'])) {
                $className = $options['agentClass'];
                unset($options['agentClass']);
            }
            if (!empty($options)) {
                self::$agents[$name] = new ParasiticAgent($config, $options);
            } elseif (class_exists($className)) {
                self::$agents[$name] = new $className($config);
            } else {
                throw new PhpSmsException("Not support agent `$name`.");
            }
        }

        return self::$agents[$name];
    }
public static function getAgent($name, array $options = [])
    {
        if (!self::hasAgent($name)) {
            $scheme = self::scheme($name);
            $config = self::config($name);
            if (is_array($scheme) && empty($options)) {
                $options = self::parseScheme($scheme);
            }
            if (isset($options['scheme'])) {
                unset($options['scheme']);
            }
            $className = "Toplan\\PhpSms\\{$name}Agent";
            if (isset($options['agentClass'])) {
                $className = $options['agentClass'];
                unset($options['agentClass']);
            }
            if (!empty($options)) {
                self::$agents[$name] = new ParasiticAgent($config, $options);
            } elseif (class_exists($className)) {
                self::$agents[$name] = new $className($config);
            } else {
                throw new PhpSmsException("Not support agent `$name`.");
            }
        }

        return self::$agents[$name];
    }
public static function getAgent ( $ name , array $ options = [ ] ) { if ( ! self :: hasAgent ( $ name ) ) { $ scheme = self :: scheme ( $ name ) ; $ config = self :: config ( $ name ) ; if ( is_array ( $ scheme ) && empty ( $ options ) ) { $ options = self :: parseScheme ( $ scheme ) ; } if ( isset ( $ options [ 'scheme' ] ) ) { unset ( $ options [ 'scheme' ] ) ; } $ className = "Toplan\\PhpSms\\{$name}Agent" ; if ( isset ( $ options [ 'agentClass' ] ) ) { $ className = $ options [ 'agentClass' ] ; unset ( $ options [ 'agentClass' ] ) ; } if ( ! empty ( $ options ) ) { self :: $ agents [ $ name ] = new ParasiticAgent ( $ config , $ options ) ; } elseif ( class_exists ( $ className ) ) { self :: $ agents [ $ name ] = new $ className ( $ config ) ; } else { throw new PhpSmsException ( "Not support agent `$name`." ) ; } } return self :: $ agents [ $ name ] ; }
Get the agent instance by name.

@param string $name
@param array  $options

@throws PhpSmsException

@return Agent
Get the agent instance by name .