13
13
14
14
namespace PHPJasper ;
15
15
16
+ use PHPJasper \Exception ;
17
+
16
18
class PHPJasper
17
19
{
18
20
@@ -68,7 +70,7 @@ private function checkServer()
68
70
public function compile (string $ input , string $ output = '' )
69
71
{
70
72
if (!is_file ($ input )) {
71
- throw new \ PHPJasper \ Exception \InvalidInputFile ();
73
+ throw new Exception \InvalidInputFile ();
72
74
}
73
75
74
76
$ this ->command = $ this ->checkServer ();
@@ -95,7 +97,7 @@ public function process(string $input, string $output, array $options = [])
95
97
$ options = $ this ->parseProcessOptions ($ options );
96
98
97
99
if (!$ input ) {
98
- throw new \ PHPJasper \ Exception \InvalidInputFile ();
100
+ throw new Exception \InvalidInputFile ();
99
101
}
100
102
101
103
$ this ->validateFormat ($ options ['format ' ]);
@@ -175,7 +177,7 @@ protected function validateFormat($format)
175
177
}
176
178
foreach ($ format as $ value ) {
177
179
if (!in_array ($ value , $ this ->formats )) {
178
- throw new \ PHPJasper \ Exception \InvalidFormat ();
180
+ throw new Exception \InvalidFormat ();
179
181
}
180
182
}
181
183
}
@@ -188,7 +190,7 @@ protected function validateFormat($format)
188
190
public function listParameters (string $ input )
189
191
{
190
192
if (!is_file ($ input )) {
191
- throw new \ PHPJasper \ Exception \InvalidInputFile ();
193
+ throw new Exception \InvalidInputFile ();
192
194
}
193
195
194
196
$ this ->command = $ this ->checkServer ();
@@ -216,7 +218,7 @@ public function execute($user = false)
216
218
chdir ($ this ->pathExecutable );
217
219
exec ($ this ->command , $ output , $ returnVar );
218
220
if ($ returnVar !== 0 ) {
219
- throw new \ PHPJasper \ Exception \ErrorCommandExecutable ();
221
+ throw new Exception \ErrorCommandExecutable ();
220
222
}
221
223
222
224
return $ output ;
@@ -247,10 +249,10 @@ protected function addUserToCommand($user)
247
249
protected function validateExecute ()
248
250
{
249
251
if (!$ this ->command ) {
250
- throw new \ PHPJasper \ Exception \InvalidCommandExecutable ();
252
+ throw new Exception \InvalidCommandExecutable ();
251
253
}
252
254
if (!is_dir ($ this ->pathExecutable )) {
253
- throw new \ PHPJasper \ Exception \InvalidResourceDirectory ();
255
+ throw new Exception \InvalidResourceDirectory ();
254
256
}
255
257
}
256
258
}
0 commit comments