Skip to content

Commit

Permalink
Merge pull request #73 from PHPJasper/develop
Browse files Browse the repository at this point in the history
general improvements
  • Loading branch information
geekcom authored Oct 19, 2017
2 parents 22d3114 + a7d5129 commit ed14365
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/PHPJasper.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function __construct()
$this->windows = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? true : false;
}

private function checkServer()
{
return $this->command = $this->windows ? $this->executable : './' . $this->executable;
}

/**
* @param string $input
* @param string $output optional
Expand All @@ -63,11 +68,11 @@ public function __construct()
*/
public function compile(string $input, string $output = '')
{
if ( !$input ) {
if (!$input) {
throw new \PHPJasper\Exception\InvalidInputFile();
}

$this->command = $this->windows ? $this->executable : './' . $this->executable;
$this->command = $this->checkServer();
$this->command .= ' compile ';
$this->command .= "\"$input\"";

Expand All @@ -90,12 +95,15 @@ public function compile(string $input, string $output = '')
public function process(string $input, string $output, array $options = [])
{
$options = $this->parseProcessOptions($options);

if (!$input) {
throw new \PHPJasper\Exception\InvalidInputFile();
}

$this->validateFormat($options['format']);

$this->command = $this->windows ? $this->executable : './' . $this->executable;
$this->command = $this->checkServer();

if ($options['locale']) {
$this->command .= " --locale {$options['locale']}";
}
Expand Down Expand Up @@ -186,7 +194,7 @@ public function listParameters(string $input)
throw new \PHPJasper\Exception\InvalidInputFile();
}

$this->command = $this->windows ? $this->executable : './' . $this->executable;
$this->command = $this->checkServer();
$this->command .= ' list_parameters ';
$this->command .= "\"$input\"";

Expand Down Expand Up @@ -249,5 +257,4 @@ protected function validateExecute()
}

}

}

0 comments on commit ed14365

Please sign in to comment.