File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,8 +31,9 @@ function run()
3131 }
3232
3333 $ fromFormat = $ this ->fromFormat ?: $ this ->detectFormat ($ params );
34- $ converter = isset ($ params ['converter ' ]) ? "/converter/ {$ params ['converter ' ]}" : '' ;
35- $ path = 'convert/ ' . $ fromFormat . '/to/ ' . $ this ->toFormat . $ converter ;
34+ $ converter = $ this ->detectConverter ($ params );
35+ $ converterPath = $ converter ? "/converter/ {$ converter }" : '' ;
36+ $ path = 'convert/ ' . $ fromFormat . '/to/ ' . $ this ->toFormat . $ converterPath ;
3637
3738 $ response = ConvertApi::client ()->post ($ path , $ params , $ readTimeout );
3839
@@ -91,4 +92,15 @@ private function detectFormat($params)
9192
9293 return $ detector ->run ();
9394 }
95+
96+ private function detectConverter ($ params )
97+ {
98+ $ keys = array_keys ($ params );
99+
100+ foreach ($ keys as $ key )
101+ if (strtolower ($ key ) == 'converter ' )
102+ return $ params [$ key ];
103+
104+ return ;
105+ }
94106}
You can’t perform that action at this time.
0 commit comments