From 1e2b6c5477c473eb9d2f9639bd0976be1ac2e9d4 Mon Sep 17 00:00:00 2001 From: Craig Anderson Date: Thu, 12 Jul 2018 14:09:31 -0400 Subject: [PATCH] Minor PHP 7.2 cleanups * Removed redundant PHP ending tag ?> * Added scope declarations to methods * Added return type to FusionCharts::render() --- src/fusioncharts.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/fusioncharts.php b/src/fusioncharts.php index 9708410..404b2c4 100644 --- a/src/fusioncharts.php +++ b/src/fusioncharts.php @@ -20,7 +20,7 @@ class FusionCharts { '; // constructor - function __construct($type, $id, $width = 400, $height = 300, $renderAt, $dataFormat, $dataSource) { + public function __construct($type, $id, $width = 400, $height = 300, $renderAt, $dataFormat, $dataSource) { isset($type) ? $this->constructorOptions['type'] = $type : ''; isset($id) ? $this->constructorOptions['id'] = $id : 'php-fc-'.time(); isset($width) ? $this->constructorOptions['width'] = $width : ''; @@ -57,10 +57,9 @@ function __construct($type, $id, $width = 400, $height = 300, $renderAt, $dataFo // render the chart created // It prints a script and calls the FusionCharts javascript render method of created chart - function render() { + public function render() : void { $renderHTML = preg_replace('/__chartId__/', $this->constructorOptions['id'], $this->renderTemplate); echo $renderHTML; } } -?>