@@ -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 | /** |
@@ -117,18 +117,18 @@ discard block |
||
| 117 | 117 | throw new GoogleChartsException('Container is not defined.');
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - $js = 'var ' . $this->getName() . ' = new google.' . $this->getLibrary() . '.' . $this->getType() . |
|
| 121 | - '(document.getElementById("' . $this->elementID . '"));';
|
|
| 120 | + $js = 'var '.$this->getName().' = new google.'.$this->getLibrary().'.'.$this->getType(). |
|
| 121 | + '(document.getElementById("'.$this->elementID.'"));';
|
|
| 122 | 122 | |
| 123 | 123 | if (!$this instanceof DiffChart) {
|
| 124 | 124 | $js .= $this->data->draw($this->getDataName()); |
| 125 | 125 | |
| 126 | 126 | } else {
|
| 127 | - $js .= $this->getOldChart()->getData()->draw('old_' . $this->getDataName()) .
|
|
| 128 | - $this->getNewChart()->getData()->draw('new_' . $this->getDataName()) .
|
|
| 129 | - 'var ' . $this->getDataName() . ' = ' . $this->getName() . |
|
| 130 | - '.computeDiff(old_' . $this->getDataName() . ', |
|
| 131 | - new_' . $this->getDataName() . ');'; |
|
| 127 | + $js .= $this->getOldChart()->getData()->draw('old_'.$this->getDataName()).
|
|
| 128 | + $this->getNewChart()->getData()->draw('new_'.$this->getDataName()).
|
|
| 129 | + 'var '.$this->getDataName().' = '.$this->getName(). |
|
| 130 | + '.computeDiff(old_'.$this->getDataName().', |
|
| 131 | + new_' . $this->getDataName().');'; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | $js .= $this->options->draw($this->getOptionsName()); |
@@ -143,8 +143,8 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function endDraw() |
| 145 | 145 | {
|
| 146 | - return $this->events->draw(). $this->getName() . |
|
| 147 | - '.draw('. $this->getDataName() . ', '. $this->getOptionsName() .');';
|
|
| 146 | + return $this->events->draw().$this->getName(). |
|
| 147 | + '.draw('.$this->getDataName().', '.$this->getOptionsName().');';
|
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -55,8 +55,8 @@ |
||
| 55 | 55 | $lastKeyValue = key($row); |
| 56 | 56 | foreach ($row as $key => $value) {
|
| 57 | 57 | if ($value instanceof \DateTime) {
|
| 58 | - $js .= 'new Date(' . $value->format('Y') . ', ' . ($value->format('n')-1) . ', ' .
|
|
| 59 | - $value->format('d') . ')';
|
|
| 58 | + $js .= 'new Date('.$value->format('Y').', '.($value->format('n')-1).', '.
|
|
| 59 | + $value->format('d').')';
|
|
| 60 | 60 | } else {
|
| 61 | 61 | $js .= json_encode($value); |
| 62 | 62 | } |
@@ -46,8 +46,8 @@ |
||
| 46 | 46 | $js = ''; |
| 47 | 47 | |
| 48 | 48 | foreach ($this->listeners as $listener) { |
| 49 | - $js .= "google.visualization.events.addListener(" . $this->chart->getName() . ", '" . $listener->getType() . |
|
| 50 | - "', " . $listener->getFunction() . ");"; |
|
| 49 | + $js .= "google.visualization.events.addListener(".$this->chart->getName().", '".$listener->getType(). |
|
| 50 | + "', ".$listener->getFunction().");"; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | return $js; |
@@ -40,6 +40,6 @@ |
||
| 40 | 40 | |
| 41 | 41 | $options = $this->optionsFormat->renameRecursivelyKeys($options); |
| 42 | 42 | |
| 43 | - return "var $optionsName = " . json_encode($options) . ";\n"; |
|
| 43 | + return "var $optionsName = ".json_encode($options).";\n"; |
|
| 44 | 44 | } |
| 45 | 45 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | parent::__construct(); |
| 51 | 51 | |
| 52 | 52 | $this->timeline = new Timeline(); |
| 53 | - $this->tooltip = new BasicTooltip(); |
|
| 53 | + $this->tooltip = new BasicTooltip(); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public function removeRecursivelyNullValue(&$options) |
| 18 | 18 | { |
| 19 | - $options = array_filter((array)$options, function ($val) { |
|
| 19 | + $options = array_filter((array)$options, function($val) { |
|
| 20 | 20 | return !is_null($val); |
| 21 | 21 | }); |
| 22 | 22 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | ); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $callback = function ($item) { |
|
| 135 | + $callback = function($item) { |
|
| 136 | 136 | if (!is_string($item)) { |
| 137 | 137 | throw new GoogleChartsException('A string is expected for HTML element ID.'); |
| 138 | 138 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | private function checkChartType($charts) |
| 160 | 160 | { |
| 161 | - $callback = function ($item) { |
|
| 161 | + $callback = function($item) { |
|
| 162 | 162 | if (!$item instanceof Chart) { |
| 163 | 163 | throw new GoogleChartsException('An instance of Chart or an array of Chart is expected.'); |
| 164 | 164 | } |
@@ -175,16 +175,16 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | private function loadLibraries($packages) |
| 177 | 177 | { |
| 178 | - array_walk($packages, function (&$item) { |
|
| 179 | - $item = '"' . $item . '"'; |
|
| 178 | + array_walk($packages, function(&$item) { |
|
| 179 | + $item = '"'.$item.'"'; |
|
| 180 | 180 | }); |
| 181 | 181 | $packages = implode(',', $packages); |
| 182 | 182 | |
| 183 | 183 | if (in_array($this->version, array('1', '1.1'))) { |
| 184 | - return 'google.load("visualization", "' . $this->version . '", {packages:[' . $packages . ']});'; |
|
| 184 | + return 'google.load("visualization", "'.$this->version.'", {packages:['.$packages.']});'; |
|
| 185 | 185 | |
| 186 | 186 | } else { |
| 187 | - return 'google.charts.load("' . $this->version . '", {packages: [' . $packages . ']});'; |
|
| 187 | + return 'google.charts.load("'.$this->version.'", {packages: ['.$packages.']});'; |
|
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | $js = $this->loadLibraries($packages); |
| 238 | 238 | |
| 239 | - $js .= $this->startCallback('drawChart' . ucfirst(md5($drawChartName))); |
|
| 239 | + $js .= $this->startCallback('drawChart'.ucfirst(md5($drawChartName))); |
|
| 240 | 240 | |
| 241 | 241 | foreach ($charts as $chart) { |
| 242 | 242 | $js .= $chart->startDraw(); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | public function drawCharts($charts, $elementsID = null) |
| 277 | 277 | { |
| 278 | - return $this->startCharts($charts, $elementsID) . $this->endCharts($charts); |
|
| 278 | + return $this->startCharts($charts, $elementsID).$this->endCharts($charts); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |