Return connection base type device
@param array $params
@param string $type
@return object
448
public function getConnection(array $params, $type) {
        if ($type == 'S') {
            $host = (!empty($params['num_ip'])) ? $params['num_ip'] : '127.0.0.1';
            $community = (!empty($params['des_snmp_community'])) ? $params['des_snmp_community'] : 'public';
            $version = (!empty($params['des_snmp_version'])) ? $params['des_snmp_version'] : '2c';
            $seclevel = (!empty($params['des_snmp_sec_level'])) ? $params['des_snmp_sec_level'] : 'noAuthNoPriv';
            $authprotocol = (!empty($params['des_snmp_auth_protocol'])) ? $params['des_snmp_auth_protocol'] : 'MD5';
            $authpassphrase = (!empty($params['des_snmp_auth_passphrase'])) ? $params['des_snmp_auth_passphrase'] : 'None';
            $privprotocol = (!empty($params['des_snmp_priv_protocol'])) ? $params['des_snmp_priv_protocol'] : 'DES';
            $privpassphrase = (!empty($params['des_snmp_priv_passphrase'])) ? $params['des_snmp_priv_passphrase'] : 'None';

            $connection = new \Cityware\Snmp\SNMP($host, $community, $version, $seclevel, $authprotocol, $authpassphrase, $privprotocol, $privpassphrase);
            $connection->setSecLevel(3);
            $connection->disableCache();

            $this->setSnmpCon($connection);
        } else if ($type == 'W') {
            $host = (!empty($params['num_ip'])) ? $params['num_ip'] : '127.0.0.1';
            $username = (!empty($params['des_wmi_user'])) ? $params['des_wmi_user'] : null;
            $password = (!empty($params['des_wmi_password'])) ? $params['des_wmi_password'] : null;
            $domain = (!empty($params['des_wmi_domain'])) ? $params['des_wmi_domain'] : null;
            $wmi = new \Cityware\Wmi\Wmi($host, $username, $password, $domain);
            $connection = $wmi->connect('root\\cimv2');
            $this->setWmiCon($connection);
        }

        return $connection;
    }
1288717
protected function getIrcMessage($type, array $params = array())
    {
        $message = '';
        if ($this->prefix) {
            $message .= ':' . $this->prefix . ' ';
        }
        $message .= $type;

        $params = array_filter($params, function($param) {
            return $param !== null;
        });
        if ($params) {
            $last = end($params);
            $params[key($params)] = ':' . $last; 
            $message .= ' ' . implode(' ', $params);
        }
        
        $message .= "\r\n";
        return $message;
    }
567629
public static function get(array $params = [])
    {
        if (empty(self::$singleton)) {
            self::$singleton = static::create($params);
        }

        return self::$singleton;
    }
331464
static function getArrayType($type){
        self::isArray($type) or \PhpBoot\abort(new \InvalidArgumentException("$type is not array"));
        if($type == 'array') {
            return 'mixed';
        }else{
            return substr($type,0,-2);
        }
    }
875702
public function createConnection(array $params, Configuration $config = null, EventManager $eventManager = null, array $mappingTypes = [])
    {
        if (! $this->initialized) {
            $this->initializeTypes();
        }

        $connection = DriverManager::getConnection($params, $config, $eventManager);

        if (! empty($mappingTypes)) {
            $platform = $this->getDatabasePlatform($connection);
            foreach ($mappingTypes as $dbType => $doctrineType) {
                $platform->registerDoctrineTypeMapping($dbType, $doctrineType);
            }
        }

        if (! empty($this->typesConfig)) {
            $this->markTypesCommented($this->getDatabasePlatform($connection));
        }

        return $connection;
    }
147163
public static function types($params = null, $apiKey = null)
    {
        $requestor = new Requestor($apiKey);
        list($response, $apiKey) = $requestor->request('get', '/carrier_types', $params);
        return Util::convertToEasyPostObject($response, $apiKey);
    }
249788
public static function get($type)
    {
        if (!array_key_exists($type, self::$endpoints)) {
            throw new \RuntimeException('Endpoint does not exist.');
        }

        return new self::$endpoints[$type]();
    }
755631
public static function getType($type)
    {
        if (!isset(static::$mappedTypeInstances[$type])) {
            if (!static::hasType($type)) {
                throw TypeException::typeDoesNotExist($type);
            }

            static::$mappedTypeInstances[$type] = new static::$mappedTypeClasses[$type]();
        }

        return static::$mappedTypeInstances[$type];
    }
831916
protected static function extractType($type)
    {
        if (substr($type, -2) === Connection::PARAM_ARRAY) {
            return substr($type, 0, strlen($type) - 2);
        }

        return false;
    }
484938
private function sign($type, &$params)
	{

		ksort($params);
		$str4sign = implode('|', $params);
		$sign = md5($str4sign . $type . $this->configParams['secretKey']);

		return $sign;

	}
129797
protected function cacheKey($type, $params)
    {
        return sprintf('%s:%s:%s', $this->cachePrefix, $type, md5(http_build_query($params)));
    }
53743
public function send(array $params, $type = self::TYPE_NORMAL)
    {
        $api = ($type === self::TYPE_NORMAL) ? self::API_SEND : self::API_SEND_GROUP;

        $params['wxappid'] = $this->merchant->app_id;
        //如果类型为分裂红则去掉client_ip参数,否则签名会出错
        if ($type === self::TYPE_GROUP) {
            unset($params['client_ip']);
        }

        return $this->request($api, $params);
    }
829006
public function get_objects($type, $param_options = array()) {
    if ($this->cache) {
      $signature = $this->createSignature($type . '/', $param_options);
      if ($this->cache->contains($signature)) {
        return $this->cache->fetch($signature);
      }
    }

    $resp = $this->call($type, $param_options);
    $result = $this->parse_result($resp['data']);

    if ($this->cache) {    
      $this->cache->save($signature, $result);
    }

    return $result;
  }
1211865
public static function createObject($type, array $params = [])
    {
        if (is_string($type)) {
            return new $type;
        } elseif (is_array($type)) {
            $class = '\\PG\\I18N\\' . ($type['class'] ?? 'PhpMessageSource');
            unset($type['class']);
            $clazz = new $class;
            foreach ($type as $prop => $val) {
                $clazz->$prop = $val;
            }
            return $clazz;
        }

        throw new \Exception('Unsupported configuration type: ' . gettype($type));
    }
469059
public static ConnectionType getConnectionType(byte type) {
        switch (type) {
            case TYPE_OUTBOUND:
                return OUTBOUND;
            case TYPE_OUTBOUND_CR_TO_REMOTE:
                return OUTBOUND_CR_TO_REMOTE;
            case TYPE_OUTBOUND_SR_TO_CR_REMOTE:
                return OUTBOUND_SR_TO_CR_REMOTE;

            case TYPE_INBOUND:
                return INBOUND;
            case TYPE_INBOUND_CR:
                return INBOUND_CR;

            case TYPE_INTERNAL_CR_SR:
                return INTERNAL_CR_SR;
        }

        return null;
    }
1214019
private function _constructPdoDsn(array $params)
    {
        $dsn = 'ibm:';
        if (isset($params['host'])) {
            $dsn .= 'HOSTNAME=' . $params['host'] . ';';
        }
        if (isset($params['port'])) {
            $dsn .= 'PORT=' . $params['port'] . ';';
        }
        $dsn .= 'PROTOCOL=TCPIP;';
        if (isset($params['dbname'])) {
            $dsn .= 'DATABASE=' . $params['dbname'] . ';';
        }

        return $dsn;
    }
308006
private static function getCacheKeyForCall(array $params)
    {
        static $domainLevel = null;

        $params += $_GET;
        $keyStr = '';
        foreach ($params as $param) {
            $keyStr .= serialize($param);
        }

        $keyStr .= Request::domainPrefix(
            $domainLevel ?? $domainLevel = count(explode('.', Config::application('domain')))
        );

        return md5($keyStr);
    }