Gets the connection

@param   string $type Class name of the connection

@return  \Doctrine\DBAL\Connection|CsvDataGateway
768628
public function getConnection($type = null)
    {
        if (is_null($type)) {
            return $this->connection;
        }

        if (!isset($this->connections[CsvDataGateway::class]) && !empty($this->config['dataPath'])) {
            $this->connections[CsvDataGateway::class] = new CsvDataGateway(
                JPATH_ROOT . '/' . $this->config['dataPath']
            );
        }

        if (!isset($this->connections[Connection::class]) && !empty($this->config['databaseUrl'])) {
            $databaseUrl = $this->config['databaseUrl'];
            $url         = parse_url($databaseUrl);

            if ($url['schema'] == 'sqlite') {
                $databaseUrl = str_replace('sqlite://', 'sqlite://' . JPATH_ROOT, $databaseUrl);
            }

            $this->connections[Connection::class] = DriverManager::getConnection(['url' => $databaseUrl]);
        }

        return $this->connections[$type];
    }
126592
private function getClientInternal($type = null) {
		if ($type != null) {
			if (isset($this->clients[$type])) {
				return $this->clients[$type];
			} else {
				throw new \Exception("No http client with type '$type' found.");
			}
		} else {
			foreach ($this->clients as $client) {
				if ($client->isSupported()) {
					return $client;
				}
			}
			throw new \Exception('No supported http client found.');
		}
	}
704328
protected function getRelationshipsThatMatchType($type)
    {
        return array_filter(
            $this->mapRelationshipsToIdAndData(),
            function ($relationship) use ($type) {
                $relationshipType = Arr::get($relationship, 'type');

                return Str::snakeCase($type) === Str::snakeCase($relationshipType);
            }
        );
    }
550828
public function get($type = FALSE)
  {
    $result = $this->peek($type);
	
    $this->clear($type);
	
    return $result;
  }
1254610
public function getTransformer($type)
    {
        return isset($this->methods[$type]) ? $this->methods[$type] : null;
    }
441521
public static function retrieveTypeObject($type)
    {
        if (!array_key_exists($type, static::$typesMap)) {
            throw new BadArgumentException('Unable create column type object with name ":type" because cannot find it', [
                'type' => $type,
            ]);
        }
        
        $class = static::$typesMap[$type];
        
        return new $class($type);
    }
141258
private static function getMappedType($type)
    {
        if (!isset(self::$mappedTypes[$type])) {
            throw MysqliException::mappedTypeDoesNotExist($type);
        }

        return self::$mappedTypes[$type];
    }
872724
protected function getResultsByType($type)
    {
        $instance = $this->createModelByType($type);

        $key = $instance->getKeyName();

        $query = $instance->newQuery();

        $query = $this->useWithTrashed($query);

        return $query->whereIn($key, $this->gatherKeysByType($type)->all())->get();
    }
728146
public function get($type)
    {
        if (isset($this->definitions[$type])) {
            return $this->definitions[$type];
        }

        throw new UnregisteredDefinitionException(
            $type,
            UnregisteredDefinitionException::TARGET_MIME_TYPE
        );
    }
132690
public static function getType($type)
    {
        if (!isset(self::$typesMap[$type])) {
            throw new \InvalidArgumentException(sprintf('Invalid type specified "%s".', $type));
        }
        if (!isset(self::$typeObjects[$type])) {
            $className                = self::$typesMap[$type];
            self::$typeObjects[$type] = new $className;
        }

        return self::$typeObjects[$type];
    }
1213189
public static function get($type)
    {
        if (!isset(static::$_modelFactories['Table'])) {
            static::$_modelFactories['Table'] = [TableRegistry::getTableLocator(), 'get'];
        }

        if (!isset(static::$_modelFactories[$type])) {
            throw new InvalidArgumentException(sprintf(
                'Unknown repository type "%s". Make sure you register a type before trying to use it.',
                $type
            ));
        }

        return static::$_modelFactories[$type];
    }
704561
private function getEndpoint($type)
    {
        if (!array_key_exists($type, $this->endpoints)) {
            $this->endpoints[$type] = SearchEndpointFactory::get($type);
        }

        return $this->endpoints[$type];
    }
308580
private function getHandler($type)
    {
        if (!isset(self::$typeHandlers[$type])) {
            throw new Exception("Unsupported PDO param type - " . $type);
        }

        return self::$typeHandlers[$type];
    }
99449
public function get($type)
    {
        if (!isset($this->instances[$type])) {

            if (!isset($this->services[$type])) {
                if ($this->debug) {
                    trigger_error(sprintf("Widget type '%s' does not exist, returning a null implementation", $type), E_USER_ERROR);
                }
                // This primarily meant to display stuff, we should never WSOD
                // in the user's face, return a null object instead that will
                // UI operations smooth and error tolerant.
                return new NullWidget();
            }

            $this->instances[$type] = $this->container->get($this->services[$type]);
        }

        return $this->instances[$type];
    }
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;
    }
658943
public function getChatClassString($type) {
        /** @var EntityManager $em */
        $em = $this->container->get('doctrine')->getManager();

        $chatClass = "Sopinet\ChatBundle\Entity\Chat";

        $cmf = $em->getMetadataFactory();
        $meta = $cmf->getMetadataFor($chatClass);

        $config = $this->container->getParameter('sopinet_chat.config');
        foreach($meta->discriminatorMap as $typeString => $typeClass) {
            if ($typeString == $type) {
                return $typeClass;
            }
        }

        // Type unknow
        return null;
    }
1296684
protected function getJoinTable($type)
    {
        switch ($type) {
            case self::DELETE:
                // Delete uses edit type - Drop through
            case self::EDIT:
                return $this->getEditorGroupsTable();
            case self::VIEW:
                return $this->getViewerGroupsTable();
            default:
                throw new InvalidArgumentException("Invalid argument type $type");
        }
    }