@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function getName() |
| 48 | 48 | {
|
| 49 | - return 'chart' . ucfirst($this->elementID); |
|
| 49 | + return 'chart'.ucfirst($this->elementID); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function getDataName() |
| 58 | 58 | {
|
| 59 | - return 'data'. ucfirst($this->getName()); |
|
| 59 | + return 'data'.ucfirst($this->getName()); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function getOptionsName() |
| 68 | 68 | {
|
| 69 | - return 'options'. ucfirst($this->getName()); |
|
| 69 | + return 'options'.ucfirst($this->getName()); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -110,18 +110,18 @@ discard block |
||
| 110 | 110 | throw new GoogleChartsException('Container is not defined.');
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - $js = 'var ' . $this->getName() . ' = new google.visualization.' . $this->getType() . |
|
| 114 | - '(document.getElementById("' . $this->elementID . '"));';
|
|
| 113 | + $js = 'var '.$this->getName().' = new google.visualization.'.$this->getType(). |
|
| 114 | + '(document.getElementById("'.$this->elementID.'"));';
|
|
| 115 | 115 | |
| 116 | 116 | if (!$this instanceof DiffChart) {
|
| 117 | 117 | $js .= $this->data->draw($this->getDataName()); |
| 118 | 118 | |
| 119 | 119 | } else {
|
| 120 | - $js .= $this->getOldChart()->getData()->draw('old_' . $this->getDataName()) .
|
|
| 121 | - $this->getNewChart()->getData()->draw('new_' . $this->getDataName()) .
|
|
| 122 | - 'var ' . $this->getDataName() . ' = ' . $this->getName() . |
|
| 123 | - '.computeDiff(old_' . $this->getDataName() . ', |
|
| 124 | - new_' . $this->getDataName() . ');'; |
|
| 120 | + $js .= $this->getOldChart()->getData()->draw('old_'.$this->getDataName()).
|
|
| 121 | + $this->getNewChart()->getData()->draw('new_'.$this->getDataName()).
|
|
| 122 | + 'var '.$this->getDataName().' = '.$this->getName(). |
|
| 123 | + '.computeDiff(old_'.$this->getDataName().', |
|
| 124 | + new_' . $this->getDataName().');'; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | $js .= $this->options->draw($this->getOptionsName()); |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function endDraw() |
| 138 | 138 | {
|
| 139 | - return $this->events->draw(). $this->getName() . |
|
| 140 | - '.draw('. $this->getDataName() . ', '. $this->getOptionsName() .');';
|
|
| 139 | + return $this->events->draw().$this->getName(). |
|
| 140 | + '.draw('.$this->getDataName().', '.$this->getOptionsName().');';
|
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | ); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - $callback = function ($item) { |
|
| 162 | + $callback = function($item) { |
|
| 163 | 163 | if (!is_string($item)) { |
| 164 | 164 | throw new GoogleChartsException('A string is expected for HTML element ID.'); |
| 165 | 165 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | private function checkChartType($charts) |
| 187 | 187 | { |
| 188 | - $callback = function ($item) { |
|
| 188 | + $callback = function($item) { |
|
| 189 | 189 | if (!$item instanceof Chart) { |
| 190 | 190 | throw new GoogleChartsException('An instance of Chart or an array of Chart is expected.'); |
| 191 | 191 | } |
@@ -202,13 +202,13 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | private function loadLibraries($packages) |
| 204 | 204 | { |
| 205 | - array_walk($packages, function (&$item) { |
|
| 206 | - $item = "'" . $item . "'"; |
|
| 205 | + array_walk($packages, function(&$item) { |
|
| 206 | + $item = "'".$item."'"; |
|
| 207 | 207 | }); |
| 208 | 208 | |
| 209 | - ($this->language) ? $language = ", language: '" . $this->language . "'" : $language = ''; |
|
| 209 | + ($this->language) ? $language = ", language: '".$this->language."'" : $language = ''; |
|
| 210 | 210 | |
| 211 | - $load = "'" . $this->version . "', {packages:[" . implode(',', $packages) . ']' . $language . '}'; |
|
| 211 | + $load = "'".$this->version."', {packages:[".implode(',', $packages).']'.$language.'}'; |
|
| 212 | 212 | |
| 213 | 213 | return "google.charts.load($load);"; |
| 214 | 214 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | $js = $this->loadLibraries($packages); |
| 263 | 263 | |
| 264 | - $js .= $this->startCallback('drawChart' . ucfirst(md5($drawChartName))); |
|
| 264 | + $js .= $this->startCallback('drawChart'.ucfirst(md5($drawChartName))); |
|
| 265 | 265 | |
| 266 | 266 | foreach ($charts as $chart) { |
| 267 | 267 | $js .= $chart->startDraw(); |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | */ |
| 301 | 301 | public function drawCharts($charts, $elementsID = null) |
| 302 | 302 | { |
| 303 | - return $this->startCharts($charts, $elementsID) . $this->endCharts($charts); |
|
| 303 | + return $this->startCharts($charts, $elementsID).$this->endCharts($charts); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | /** |