code: protected static function parseDsn($dsn) {
          $parts = parse_url($dsn);
          $protocol = $parts['scheme'];
          $servers = $parts['host'] . ':' . $parts['port'];
          if (isset($parts['path'])) {
              $path = explode('/', $parts['path']);
              list($index, $type) = array_values(array_filter($path));
          }
          return compact('protocol', 'servers', 'index', 'type');
      }
docs: Parse a DSN string into an associative array
  
  @param string $dsn
  @return array