Skip to content

Commit d5dfce4

Browse files
author
Daniel Rodrigues Lima
committed
general updates
1 parent 1f7bfe8 commit d5dfce4

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

src/JasperPHP/JasperPHP.php

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ function __construct($resource_dir = false)
1818
{
1919
$this->path_executable = __DIR__ . '/../JasperStarter/bin'; //Path to executable
2020
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
21-
$this->windows = true;
21+
$this->windows = true;
2222
}
2323

2424
if (!$resource_dir) {
2525
$this->resource_directory = __DIR__ . '/../../../vendor/geekcom/jasperphp/src/JasperStarter/bin';
2626
} else {
2727
if (!file_exists($resource_dir)) {
28-
throw new \Exception('Invalid resource directory.', 1);
28+
throw new \Exception('Invalid resource directory.', 1);
2929
}
3030

3131
$this->resource_directory = $resource_dir;
@@ -44,7 +44,7 @@ public static function __callStatic($method, $parameters)
4444
public function compile($input_file, $output_file = false, $background = true, $redirect_output = true)
4545
{
4646
if (is_null($input_file) || empty($input_file)) {
47-
throw new \Exception('No input file', 1);
47+
throw new \Exception('No input file', 1);
4848
}
4949

5050
$command = ($this->windows) ? $this->executable : './' . $this->executable;
@@ -54,7 +54,7 @@ public function compile($input_file, $output_file = false, $background = true, $
5454
$command .= "\"$input_file\"";
5555

5656
if ($output_file !== false) {
57-
$command .= ' -o ' . "\"$output_file\"";
57+
$command .= ' -o ' . "\"$output_file\"";
5858
}
5959

6060
$this->redirect_output = $redirect_output;
@@ -67,18 +67,18 @@ public function compile($input_file, $output_file = false, $background = true, $
6767
public function process($input_file, $output_file = false, $format = array('pdf'), $parameters = array(), $db_connection = array(), $locale = false, $background = true, $redirect_output = true)
6868
{
6969
if (is_null($input_file) || empty($input_file)) {
70-
throw new \Exception('No input file', 1);
70+
throw new \Exception('No input file', 1);
7171
}
7272

7373
if (is_array($format)) {
7474
foreach ($format as $key) {
7575
if (!in_array($key, $this->formats)) {
76-
throw new \Exception('Invalid format!', 1);
76+
throw new \Exception('Invalid format!', 1);
7777
}
7878
}
7979
} else {
8080
if (!in_array($format, $this->formats)) {
81-
throw new \Exception('Invalid format!', 1);
81+
throw new \Exception('Invalid format!', 1);
8282
}
8383
}
8484

@@ -91,13 +91,13 @@ public function process($input_file, $output_file = false, $format = array('pdf'
9191
$command .= "\"$input_file\"";
9292

9393
if ($output_file !== false) {
94-
$command .= ' -o ' . "\"$output_file\"";
94+
$command .= ' -o ' . "\"$output_file\"";
9595
}
9696

9797
if (is_array($format)) {
98-
$command .= ' -f ' . join(' ', $format);
98+
$command .= ' -f ' . join(' ', $format);
9999
} else {
100-
$command .= ' -f ' . $format;
100+
$command .= ' -f ' . $format;
101101
}
102102

103103

@@ -115,51 +115,51 @@ public function process($input_file, $output_file = false, $format = array('pdf'
115115
$command .= ' -t ' . $db_connection['driver'];
116116

117117
if (isset($db_connection['username'])) {
118-
$command .= " -u " . $db_connection['username'];
118+
$command .= " -u " . $db_connection['username'];
119119
}
120120

121121
if (isset($db_connection['password']) && !empty($db_connection['password'])) {
122-
$command .= ' -p ' . $db_connection['password'];
122+
$command .= ' -p ' . $db_connection['password'];
123123
}
124124

125125
if (isset($db_connection['host']) && !empty($db_connection['host'])) {
126-
$command .= ' -H ' . $db_connection['host'];
126+
$command .= ' -H ' . $db_connection['host'];
127127
}
128128

129129
if (isset($db_connection['database']) && !empty($db_connection['database'])) {
130-
$command .= ' -n ' . $db_connection['database'];
130+
$command .= ' -n ' . $db_connection['database'];
131131
}
132132

133133
if (isset($db_connection['port']) && !empty($db_connection['port'])) {
134-
$command .= ' --db-port ' . $db_connection['port'];
134+
$command .= ' --db-port ' . $db_connection['port'];
135135
}
136136

137137
if (isset($db_connection['jdbc_driver']) && !empty($db_connection['jdbc_driver'])) {
138-
$command .= ' --db-driver ' . $db_connection['jdbc_driver'];
138+
$command .= ' --db-driver ' . $db_connection['jdbc_driver'];
139139
}
140140

141141
if (isset($db_connection['jdbc_url']) && !empty($db_connection['jdbc_url'])) {
142-
$command .= ' --db-url ' . $db_connection['jdbc_url'];
142+
$command .= ' --db-url ' . $db_connection['jdbc_url'];
143143
}
144144

145145
if (isset($db_connection['jdbc_dir']) && !empty($db_connection['jdbc_dir'])) {
146-
$command .= ' --jdbc-dir ' . $db_connection['jdbc_dir'];
146+
$command .= ' --jdbc-dir ' . $db_connection['jdbc_dir'];
147147
}
148148

149149
if (isset($db_connection['db_sid']) && !empty($db_connection['db_sid'])) {
150-
$command .= ' --db-sid ' . $db_connection['db_sid'];
150+
$command .= ' --db-sid ' . $db_connection['db_sid'];
151151
}
152152

153153
if (isset($db_connection['xml_xpath'])) {
154-
$command .= ' --xml-xpath ' . $db_connection['xml_xpath'];
154+
$command .= ' --xml-xpath ' . $db_connection['xml_xpath'];
155155
}
156156

157157
if (isset($db_connection['data_file'])) {
158-
$command .= ' --data-file ' . $db_connection['data_file'];
158+
$command .= ' --data-file ' . $db_connection['data_file'];
159159
}
160160

161161
if (isset($db_connection['json_query'])) {
162-
$command .= ' --json-query ' . $db_connection['json_query'];
162+
$command .= ' --json-query ' . $db_connection['json_query'];
163163
}
164164
}
165165

@@ -173,7 +173,7 @@ public function process($input_file, $output_file = false, $format = array('pdf'
173173
public function list_parameters($input_file)
174174
{
175175
if (is_null($input_file) || empty($input_file)) {
176-
throw new \Exception('No input file', 1);
176+
throw new \Exception('No input file', 1);
177177
}
178178

179179
$command = ($this->windows) ? $this->executable : './' . $this->executable;
@@ -196,7 +196,7 @@ public function execute($run_as_user = false)
196196
{
197197

198198
if ($run_as_user !== false && strlen($run_as_user > 0) && !$this->windows) {
199-
$this->the_command = 'su -u ' . $run_as_user . " -c \"" . $this->the_command . "\"";
199+
$this->the_command = 'su -u ' . $run_as_user . " -c \"" . $this->the_command . "\"";
200200
}
201201

202202
$output = array();
@@ -210,7 +210,7 @@ public function execute($run_as_user = false)
210210
}
211211

212212
if ($return_var != 0) {
213-
throw new \Exception('Your report has an error and couldn \'t be processed!\ Try to output the command using the function `output();` and run it manually in the console.', 1);
213+
throw new \Exception('Your report has an error and couldn \'t be processed!\ Try to output the command using the function `output();` and run it manually in the console.', 1);
214214
}
215215

216216
return $output;

0 commit comments

Comments
 (0)