lib/Doctrine/DBAL/Driver/AbstractOracleDriver/EasyConnectString.php
public static function fromConnectionParameters(array $params) : self
    {
        if (! empty($params['connectstring'])) {
            return new self($params['connectstring']);
        }

        if (empty($params['host'])) {
            return new self($params['dbname'] ?? '');
        }

        $connectData = [];

        if (isset($params['servicename']) || isset($params['dbname'])) {
            $serviceKey = 'SID';

            if (! empty($params['service'])) {
                $serviceKey = 'SERVICE_NAME';
            }

            $serviceName = $params['servicename'] ?? $params['dbname'];

            $connectData[$serviceKey] = $serviceName;
        }

        if (! empty($params['instancename'])) {
            $connectData['INSTANCE_NAME'] = $params['instancename'];
        }

        if (! empty($params['pooled'])) {
            $connectData['SERVER'] = 'POOLED';
        }

        return self::fromArray([
            'DESCRIPTION' => [
                'ADDRESS' => [
                    'PROTOCOL' => 'TCP',
                    'HOST' => $params['host'],
                    'PORT' => $params['port'] ?? 1521,
                ],
                'CONNECT_DATA' => $connectData,
            ],
        ]);
    }
public static function fromConnectionParameters(array $params) : self
    {
        if (! empty($params['connectstring'])) {
            return new self($params['connectstring']);
        }

        if (empty($params['host'])) {
            return new self($params['dbname'] ?? '');
        }

        $connectData = [];

        if (isset($params['servicename']) || isset($params['dbname'])) {
            $serviceKey = 'SID';

            if (! empty($params['service'])) {
                $serviceKey = 'SERVICE_NAME';
            }

            $serviceName = $params['servicename'] ?? $params['dbname'];

            $connectData[$serviceKey] = $serviceName;
        }

        if (! empty($params['instancename'])) {
            $connectData['INSTANCE_NAME'] = $params['instancename'];
        }

        if (! empty($params['pooled'])) {
            $connectData['SERVER'] = 'POOLED';
        }

        return self::fromArray([
            'DESCRIPTION' => [
                'ADDRESS' => [
                    'PROTOCOL' => 'TCP',
                    'HOST' => $params['host'],
                    'PORT' => $params['port'] ?? 1521,
                ],
                'CONNECT_DATA' => $connectData,
            ],
        ]);
    }
public static function fromConnectionParameters ( array $ params ) : self { if ( ! empty ( $ params [ 'connectstring' ] ) ) { return new self ( $ params [ 'connectstring' ] ) ; } if ( empty ( $ params [ 'host' ] ) ) { return new self ( $ params [ 'dbname' ] ?? '' ) ; } $ connectData = [ ] ; if ( isset ( $ params [ 'servicename' ] ) || isset ( $ params [ 'dbname' ] ) ) { $ serviceKey = 'SID' ; if ( ! empty ( $ params [ 'service' ] ) ) { $ serviceKey = 'SERVICE_NAME' ; } $ serviceName = $ params [ 'servicename' ] ?? $ params [ 'dbname' ] ; $ connectData [ $ serviceKey ] = $ serviceName ; } if ( ! empty ( $ params [ 'instancename' ] ) ) { $ connectData [ 'INSTANCE_NAME' ] = $ params [ 'instancename' ] ; } if ( ! empty ( $ params [ 'pooled' ] ) ) { $ connectData [ 'SERVER' ] = 'POOLED' ; } return self :: fromArray ( [ 'DESCRIPTION' => [ 'ADDRESS' => [ 'PROTOCOL' => 'TCP' , 'HOST' => $ params [ 'host' ] , 'PORT' => $ params [ 'port' ] ?? 1521 , ] , 'CONNECT_DATA' => $ connectData , ] , ] ) ; }
Creates the object from the given DBAL connection parameters.

@param mixed[] $params
Creates the object from the given DBAL connection parameters .