@@ -55,6 +55,11 @@ public function __construct()
55
55
$ this ->windows = strtoupper (substr (PHP_OS , 0 , 3 )) === 'WIN ' ? true : false ;
56
56
}
57
57
58
+ private function checkServer ()
59
+ {
60
+ return $ this ->command = $ this ->windows ? $ this ->executable : './ ' . $ this ->executable ;
61
+ }
62
+
58
63
/**
59
64
* @param string $input
60
65
* @param string $output optional
@@ -63,11 +68,11 @@ public function __construct()
63
68
*/
64
69
public function compile (string $ input , string $ output = '' )
65
70
{
66
- if ( !$ input ) {
71
+ if (!$ input ) {
67
72
throw new \PHPJasper \Exception \InvalidInputFile ();
68
73
}
69
74
70
- $ this ->command = $ this ->windows ? $ this -> executable : ' ./ ' . $ this -> executable ;
75
+ $ this ->command = $ this ->checkServer () ;
71
76
$ this ->command .= ' compile ' ;
72
77
$ this ->command .= "\"$ input \"" ;
73
78
@@ -90,12 +95,15 @@ public function compile(string $input, string $output = '')
90
95
public function process (string $ input , string $ output , array $ options = [])
91
96
{
92
97
$ options = $ this ->parseProcessOptions ($ options );
98
+
93
99
if (!$ input ) {
94
100
throw new \PHPJasper \Exception \InvalidInputFile ();
95
101
}
102
+
96
103
$ this ->validateFormat ($ options ['format ' ]);
97
104
98
- $ this ->command = $ this ->windows ? $ this ->executable : './ ' . $ this ->executable ;
105
+ $ this ->command = $ this ->checkServer ();
106
+
99
107
if ($ options ['locale ' ]) {
100
108
$ this ->command .= " --locale {$ options ['locale ' ]}" ;
101
109
}
@@ -186,7 +194,7 @@ public function listParameters(string $input)
186
194
throw new \PHPJasper \Exception \InvalidInputFile ();
187
195
}
188
196
189
- $ this ->command = $ this ->windows ? $ this -> executable : ' ./ ' . $ this -> executable ;
197
+ $ this ->command = $ this ->checkServer () ;
190
198
$ this ->command .= ' list_parameters ' ;
191
199
$ this ->command .= "\"$ input \"" ;
192
200
@@ -249,5 +257,4 @@ protected function validateExecute()
249
257
}
250
258
251
259
}
252
-
253
260
}
0 commit comments