@@ -102,54 +102,24 @@ public function process($input_file, $output_file = false, $options = [])
102102 }
103103
104104 if ($ options ['db_connection ' ]) {
105- $ this ->command .= " -t {$ options ['db_connection ' ]['driver ' ]}" ;
106-
107- if (isset ($ options ['db_connection ' ]['username ' ])) {
108- $ this ->command .= " -u {$ options ['db_connection ' ]['username ' ]}" ;
109- }
110-
111- if (isset ($ options ['db_connection ' ]['password ' ]) && !empty ($ options ['db_connection ' ]['password ' ])) {
112- $ this ->command .= " -p {$ options ['db_connection ' ]['password ' ]}" ;
113- }
114-
115- if (isset ($ options ['db_connection ' ]['host ' ]) && !empty ($ options ['db_connection ' ]['host ' ])) {
116- $ this ->command .= " -H {$ options ['db_connection ' ]['host ' ]}" ;
117- }
118-
119- if (isset ($ options ['db_connection ' ]['database ' ]) && !empty ($ options ['db_connection ' ]['database ' ])) {
120- $ this ->command .= " -n {$ options ['db_connection ' ]['database ' ]}" ;
121- }
122-
123- if (isset ($ options ['db_connection ' ]['port ' ]) && !empty ($ options ['db_connection ' ]['port ' ])) {
124- $ this ->command .= " --db-port {$ options ['db_connection ' ]['port ' ]}" ;
125- }
126-
127- if (isset ($ options ['db_connection ' ]['jdbc_driver ' ]) && !empty ($ options ['db_connection ' ]['jdbc_driver ' ])) {
128- $ this ->command .= " --db-driver {$ options ['db_connection ' ]['jdbc_driver ' ]}" ;
129- }
130-
131- if (isset ($ options ['db_connection ' ]['jdbc_url ' ]) && !empty ($ options ['db_connection ' ]['jdbc_url ' ])) {
132- $ this ->command .= " --db-url {$ options ['db_connection ' ]['jdbc_url ' ]}" ;
133- }
134-
135- if (isset ($ options ['db_connection ' ]['jdbc_dir ' ]) && !empty ($ options ['db_connection ' ]['jdbc_dir ' ])) {
136- $ this ->command .= " --jdbc-dir {$ options ['db_connection ' ]['jdbc_dir ' ]}" ;
137- }
138-
139- if (isset ($ options ['db_connection ' ]['db_sid ' ]) && !empty ($ options ['db_connection ' ]['db_sid ' ])) {
140- $ this ->command .= " -db-sid {$ options ['db_connection ' ]['db_sid ' ]}" ;
141- }
142-
143- if (isset ($ options ['db_connection ' ]['xml_xpath ' ])) {
144- $ this ->command .= " --xml-xpath {$ options ['db_connection ' ]['xml_xpath ' ]}" ;
145- }
146-
147- if (isset ($ options ['db_connection ' ]['data_file ' ])) {
148- $ this ->command .= " --data-file {$ options ['db_connection ' ]['data_file ' ]}" ;
149- }
150-
151- if (isset ($ options ['db_connection ' ]['json_query ' ])) {
152- $ this ->command .= " --json-query {$ options ['db_connection ' ]['json_query ' ]}" ;
105+ $ mapDbParams = [
106+ 'driver ' => '-t ' ,
107+ 'username ' => '-u ' ,
108+ 'password ' => '-p ' ,
109+ 'host ' => '-H ' ,
110+ 'database ' => '-n ' ,
111+ 'port ' => '--db-port ' ,
112+ 'jdbc_driver ' => '--db-driver ' ,
113+ 'jdbc_url ' => '--db-url ' ,
114+ 'jdbc_dir ' => '--jdbc-dir ' ,
115+ 'db_sid ' => '-db-sid ' ,
116+ 'xml_xpath ' => '--xml-xpath ' ,
117+ 'data_file ' => '--data-file ' ,
118+ 'json_query ' => '--json-query '
119+ ];
120+
121+ foreach ($ options ['db_connection ' ] as $ key => $ value ) {
122+ $ this ->command .= " {$ mapDbParams [$ key ]} {$ value }" ;
153123 }
154124 }
155125
0 commit comments