1313
1414namespace PHPJasper ;
1515
16+ use PHPJasper \Exception ;
17+
1618class PHPJasper
1719{
1820
@@ -68,7 +70,7 @@ private function checkServer()
6870 public function compile (string $ input , string $ output = '' )
6971 {
7072 if (!is_file ($ input )) {
71- throw new \ PHPJasper \ Exception \InvalidInputFile ();
73+ throw new Exception \InvalidInputFile ();
7274 }
7375
7476 $ this ->command = $ this ->checkServer ();
@@ -95,7 +97,7 @@ public function process(string $input, string $output, array $options = [])
9597 $ options = $ this ->parseProcessOptions ($ options );
9698
9799 if (!$ input ) {
98- throw new \ PHPJasper \ Exception \InvalidInputFile ();
100+ throw new Exception \InvalidInputFile ();
99101 }
100102
101103 $ this ->validateFormat ($ options ['format ' ]);
@@ -175,7 +177,7 @@ protected function validateFormat($format)
175177 }
176178 foreach ($ format as $ value ) {
177179 if (!in_array ($ value , $ this ->formats )) {
178- throw new \ PHPJasper \ Exception \InvalidFormat ();
180+ throw new Exception \InvalidFormat ();
179181 }
180182 }
181183 }
@@ -188,7 +190,7 @@ protected function validateFormat($format)
188190 public function listParameters (string $ input )
189191 {
190192 if (!is_file ($ input )) {
191- throw new \ PHPJasper \ Exception \InvalidInputFile ();
193+ throw new Exception \InvalidInputFile ();
192194 }
193195
194196 $ this ->command = $ this ->checkServer ();
@@ -216,7 +218,7 @@ public function execute($user = false)
216218 chdir ($ this ->pathExecutable );
217219 exec ($ this ->command , $ output , $ returnVar );
218220 if ($ returnVar !== 0 ) {
219- throw new \ PHPJasper \ Exception \ErrorCommandExecutable ();
221+ throw new Exception \ErrorCommandExecutable ();
220222 }
221223
222224 return $ output ;
@@ -247,10 +249,10 @@ protected function addUserToCommand($user)
247249 protected function validateExecute ()
248250 {
249251 if (!$ this ->command ) {
250- throw new \ PHPJasper \ Exception \InvalidCommandExecutable ();
252+ throw new Exception \InvalidCommandExecutable ();
251253 }
252254 if (!is_dir ($ this ->pathExecutable )) {
253- throw new \ PHPJasper \ Exception \InvalidResourceDirectory ();
255+ throw new Exception \InvalidResourceDirectory ();
254256 }
255257 }
256258}
0 commit comments