Skip to content

Commit

Permalink
Removed pretty print option.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentmuller committed Nov 28, 2023
1 parent 4bb4c19 commit f2d3c49
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/Highcharts/AbstractChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ abstract class AbstractChart implements ChartInterface
public ChartOption $lang;
public ChartOption $legend;
public ChartOption $plotOptions;
public bool $prettyPrint = false;
public ChartOption $scrollbar;
public ChartOption $series;
public ChartOption $subtitle;
Expand Down Expand Up @@ -143,7 +142,7 @@ protected function jsonEncode(ChartOption|array $data, string $name = ''): strin
return '';
}

$encoded = \json_encode($data, $this->getJsonEncodeOptions());
$encoded = \json_encode($data);

return self::SPACE . "$name: $encoded" . self::END_LINE;
}
Expand All @@ -166,7 +165,7 @@ protected function renderCallback(ChartOption $option): string
$data = $option->getData();

// Zend\Json is used in place of json_encode to preserve JS anonymous functions
$encoded = Json::encode(valueToEncode: $data, options: $this->getZendEncodeOptions());
$encoded = Json::encode(valueToEncode: $data, options: self::ZEND_ENCODE_OPTIONS);

return self::SPACE . "$name: $encoded" . self::END_LINE;
}
Expand Down Expand Up @@ -304,14 +303,4 @@ protected function renderYAxis(): string
{
return $this->renderCallback($this->yAxis);
}

private function getJsonEncodeOptions(): int
{
return $this->prettyPrint ? \JSON_PRETTY_PRINT : 0;
}

private function getZendEncodeOptions(): array
{
return \array_merge(self::ZEND_ENCODE_OPTIONS, ['prettyPrint' => $this->prettyPrint]);
}
}

0 comments on commit f2d3c49

Please sign in to comment.