Skip to content
This repository was archived by the owner on Nov 11, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ composer.lock
composer.phar
php-cs-fixer.phar

vendor
vendor/
.idea/
3 changes: 3 additions & 0 deletions DependencyInjection/ObHighchartsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Ob\HighchartsBundle\DependencyInjection;

use Exception;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
Expand All @@ -16,6 +17,8 @@ class ObHighchartsExtension extends Extension
{
/**
* {@inheritDoc}
*
* @throws Exception
*/
public function load(array $configs, ContainerBuilder $container)
{
Expand Down
2 changes: 2 additions & 0 deletions Highcharts/AbstractChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ protected function renderEngine($engine)
} elseif ($engine == 'jquery') {
return "$(function () {";
}

return '';
}

/**
Expand Down
9 changes: 5 additions & 4 deletions Highcharts/ChartOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Ob\HighchartsBundle\Highcharts;

use stdClass;

/**
* This class is part of the Ob/HighchartsBundle
* See Highcharts documentation at http://www.highcharts.com/ref/#chart
Expand All @@ -16,7 +18,7 @@ class ChartOption
public function __construct($name)
{
$this->option_name = $name;
$this->{$name} = new \stdClass();
$this->{$name} = new stdClass();
}

/**
Expand All @@ -41,15 +43,14 @@ public function __call($name, $value)
public function __get($name)
{
$option_name = $this->option_name;
$value = $this->{$option_name}->{$name};

return $value;
return $this->{$option_name}->{$name};
}

/**
* @param string $name
*
* @return mixed
* @return bool
*/
public function __isset($name)
{
Expand Down
5 changes: 2 additions & 3 deletions Highcharts/Highchart.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ public function __construct()
*/
public function render($engine = 'jquery')
{
$chartJS = "";
$chartJS .= $this->renderEngine($engine);
$chartJS = $this->renderEngine($engine);
$chartJS .= $this->renderOptions();
$chartJS .= "\n var " . (isset($this->chart->renderTo) ? $this->chart->renderTo : 'chart') . " = new Highcharts.Chart({\n";
$chartJS .= "\n var " . ($this->chart->renderTo ?? 'chart') . " = new Highcharts.Chart({\n";

// Chart
$chartJS .= $this->renderWithJavascriptCallback($this->chart->chart, "chart");
Expand Down
5 changes: 2 additions & 3 deletions Highcharts/Highstock.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ class Highstock extends AbstractChart implements ChartInterface
*/
public function render($engine = 'jquery')
{
$chartJS = "";
$chartJS .= $this->renderEngine($engine);
$chartJS = $this->renderEngine($engine);
$chartJS .= $this->renderOptions();
$chartJS .= "\n var " . (isset($this->chart->renderTo) ? $this->chart->renderTo : 'chart') . " = new Highcharts.StockChart({\n";
$chartJS .= "\n var " . ($this->chart->renderTo ?? 'chart') . " = new Highcharts.StockChart({\n";

// Chart Option
$chartJS .= $this->renderWithJavascriptCallback($this->chart->chart, "chart");
Expand Down
10 changes: 6 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,27 @@
],

"require": {
"php": "^7.2",
"php": "^7.2 || ^8.0",
"ext-json": "*",
"symfony/http-kernel": "^4.4 || ^5.0",
"symfony/dependency-injection": "^4.4 || ^5.0",
"symfony/config": "^4.4 || ^5.0",
"symfony/yaml": "^4.4 || ^5.0",
"twig/twig": "^2.10 || ^3.0",
"laminas/laminas-json": "^3.1"
"laminas/laminas-json": "^3.3"
},
"require-dev": {
"symfony/phpunit-bridge": "^4.4 || ^5.0",
"symfony/framework-bundle": "^4.4 || ^5.0",
"nyholm/symfony-bundle-test": "^1.6.1"
"nyholm/symfony-bundle-test": "^1.6.1",
"phpcompatibility/php-compatibility": "^9.3"
},
"autoload": {
"psr-4": { "Ob\\HighchartsBundle\\": "" }
},
"extra": {
"branch-alias": {
"dev-master": "1.8.x-dev"
"dev-master": "2.0.x-dev"
}
}
}