Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.

Commit

Permalink
Fixed treatment of null argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Eihen committed Feb 28, 2018
1 parent bbc1bcb commit 722d07e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ public function writeJasper()
*/
public function param(string $key, $value)
{
if (!empty($key))
{
if (!empty($key)) {
$this->params[$key] = $value;
}

Expand All @@ -78,8 +77,7 @@ public function param(string $key, $value)
*/
public function params(array $params)
{
foreach ($params as $key => $value)
{
foreach ($params as $key => $value) {
$this->param($key, $value);
}

Expand All @@ -96,7 +94,16 @@ protected function implodeParams()
if (count($this->params) > 0) {
$args = ' -P';
foreach ($this->params as $key => $value) {
$args .= ' ' . escapeshellarg($key) . '=' . (is_string($value) ? escapeshellarg($value) : $value);
$args .= ' ' . escapeshellarg($key) . '=';
if (is_null($value)) {
$args .= 'null';
} else {
if (is_string($value)) {
$args .= escapeshellarg($value);
} else {
$args .= $value;
}
}
}

return $args;
Expand Down Expand Up @@ -183,8 +190,7 @@ public function process(string $input, array $formats, bool $dontExec = false)

$command = constant('JASPERSTARTER_BIN') . " $this->locale process $input $this->output $args 2>&1";

if ($dontExec)
{
if ($dontExec) {
return $command;
}

Expand Down

0 comments on commit 722d07e

Please sign in to comment.