public static function parseDsn($string = null)
	{
		$opts = null;

		if (!empty($string)) {
			$dsn = new DSN($string);

			$port = empty($dsn->getFirstPort()) ? '' : (':' . $dsn->getFirstPort());
			$password = empty($dsn->getPassword()) ? null : $dsn->getPassword();

			$opts = [
				'driver'	=> $dsn->getProtocol(),
				'host'		=> $dsn->getFirstHost() . $port,
				'database'	=> $dsn->getDatabase(),
				'username'	=> $dsn->getUsername(),
				'password'	=> $password
			];
		}

		return $opts;
	}
public static function parseDsn($string = null)
	{
		$opts = null;

		if (!empty($string)) {
			$dsn = new DSN($string);

			$port = empty($dsn->getFirstPort()) ? '' : (':' . $dsn->getFirstPort());
			$password = empty($dsn->getPassword()) ? null : $dsn->getPassword();

			$opts = [
				'driver'	=> $dsn->getProtocol(),
				'host'		=> $dsn->getFirstHost() . $port,
				'database'	=> $dsn->getDatabase(),
				'username'	=> $dsn->getUsername(),
				'password'	=> $password
			];
		}

		return $opts;
	}
public static function parseDsn ( $ string = null ) { $ opts = null ; if ( ! empty ( $ string ) ) { $ dsn = new DSN ( $ string ) ; $ port = empty ( $ dsn -> getFirstPort ( ) ) ? '' : ( ':' . $ dsn -> getFirstPort ( ) ) ; $ password = empty ( $ dsn -> getPassword ( ) ) ? null : $ dsn -> getPassword ( ) ; $ opts = [ 'driver' => $ dsn -> getProtocol ( ) , 'host' => $ dsn -> getFirstHost ( ) . $ port , 'database' => $ dsn -> getDatabase ( ) , 'username' => $ dsn -> getUsername ( ) , 'password' => $ password ] ; } return $ opts ; }
Take a string DSN and parse it into an array of its pieces

@param null $string
@return array|null
Take a string DSN and parse it into an array of its pieces