@@ -17,15 +17,15 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function render($flags = null) |
| 19 | 19 | { |
| 20 | - $script = []; |
|
| 20 | + $script = [ ]; |
|
| 21 | 21 | |
| 22 | 22 | // First, setup the canvas context |
| 23 | - $script[] = "var ctx = document.getElementById( \"{$this->chart->getId()}\" ).getContext( \"2d\" );"; |
|
| 23 | + $script[ ] = "var ctx = document.getElementById( \"{$this->chart->getId()}\" ).getContext( \"2d\" );"; |
|
| 24 | 24 | |
| 25 | 25 | // Now, setup the chart instance |
| 26 | 26 | $jsonRenderer = new Json($this->chart); |
| 27 | 27 | $json = $jsonRenderer->render($flags); |
| 28 | - $script[] = "var chart = new Chart( ctx, {$json} );"; |
|
| 28 | + $script[ ] = "var chart = new Chart( ctx, {$json} );"; |
|
| 29 | 29 | |
| 30 | 30 | // Return the script |
| 31 | 31 | return "\nwindow.onload=(function(oldLoad){return function(){\n" |
@@ -21,22 +21,22 @@ |
||
| 21 | 21 | { |
| 22 | 22 | $config = [ |
| 23 | 23 | 'type' => constant(get_class($this->chart) . "::TYPE"), |
| 24 | - 'data' => [], |
|
| 24 | + 'data' => [ ], |
|
| 25 | 25 | ]; |
| 26 | 26 | |
| 27 | 27 | $labels = $this->chart->labels()->getArrayCopy(); |
| 28 | 28 | if ($labels) { |
| 29 | - $config['data']['labels'] = $labels; |
|
| 29 | + $config[ 'data' ][ 'labels' ] = $labels; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $dataSets = $this->chart->dataSets()->getArrayCopy(); |
| 33 | 33 | if ($dataSets) { |
| 34 | - $config['data']['datasets'] = $dataSets; |
|
| 34 | + $config[ 'data' ][ 'datasets' ] = $dataSets; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | $options = $this->chart->options()->getArrayCopy(); |
| 38 | 38 | if ($options) { |
| 39 | - $config['options'] = $options; |
|
| 39 | + $config[ 'options' ] = $options; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $output = JsonHelper::encode($config, false, [ 'enableJsonExprFinder' => true ]); |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | { |
| 221 | 221 | $renderer = new Html($this); |
| 222 | 222 | |
| 223 | - return $renderer->render(! ! $pretty ? $renderer::RENDER_PRETTY : null); |
|
| 223 | + return $renderer->render(!!$pretty ? $renderer::RENDER_PRETTY : null); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | /** |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public function createDataSet() |
| 230 | 230 | { |
| 231 | - $datasetClass = static::MODEL['dataset']; |
|
| 231 | + $datasetClass = static::MODEL[ 'dataset' ]; |
|
| 232 | 232 | |
| 233 | 233 | return new $datasetClass(); |
| 234 | 234 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | public function options() |
| 240 | 240 | { |
| 241 | 241 | if (is_null($this->options)) { |
| 242 | - $optionsClass = static::MODEL['options']; |
|
| 242 | + $optionsClass = static::MODEL[ 'options' ]; |
|
| 243 | 243 | $this->options = new $optionsClass($this); |
| 244 | 244 | } |
| 245 | 245 | |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | $className = ucfirst($type); |
| 29 | 29 | $namespace = "\\Halfpastfour\\PHPChartJS\\Chart"; |
| 30 | 30 | $path = "{$namespace}\\{$className}"; |
| 31 | - if (! class_exists($path)) { |
|
| 31 | + if (!class_exists($path)) { |
|
| 32 | 32 | throw new \InvalidArgumentException("Invalid chart type. {$path} does not exist."); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | public function getLayout() |
| 63 | 63 | { |
| 64 | 64 | if (is_null($this->layout)) { |
| 65 | - $this->layout = new Layout(); |
|
| 65 | + $this->layout = new Layout(); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | return $this->layout; |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | public function getAnimation() |
| 33 | 33 | { |
| 34 | 34 | if (is_null($this->animation)) { |
| 35 | - $this->animation = new PieAnimation(); |
|
| 35 | + $this->animation = new PieAnimation(); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | return $this->animation; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function setDisplay($display) |
| 68 | 68 | { |
| 69 | - $this->display = ! ! $display; |
|
| 69 | + $this->display = !!$display; |
|
| 70 | 70 | |
| 71 | 71 | return $this; |
| 72 | 72 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function setFullWidth($fullWidth) |
| 108 | 108 | { |
| 109 | - $this->fullWidth = ! ! $fullWidth; |
|
| 109 | + $this->fullWidth = !!$fullWidth; |
|
| 110 | 110 | |
| 111 | 111 | return $this; |
| 112 | 112 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | public function setReverse($reverse) |
| 180 | 180 | { |
| 181 | - $this->reverse = ! ! $reverse; |
|
| 181 | + $this->reverse = !!$reverse; |
|
| 182 | 182 | |
| 183 | 183 | return $this; |
| 184 | 184 | } |
@@ -210,7 +210,7 @@ |
||
| 210 | 210 | */ |
| 211 | 211 | public function setUsePointStyle($usePointStyle) |
| 212 | 212 | { |
| 213 | - $this->usePointStyle = ! ! $usePointStyle; |
|
| 213 | + $this->usePointStyle = !!$usePointStyle; |
|
| 214 | 214 | |
| 215 | 215 | return $this; |
| 216 | 216 | } |
@@ -16,10 +16,10 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public function getArrayCopy() |
| 18 | 18 | { |
| 19 | - $rows = []; |
|
| 19 | + $rows = [ ]; |
|
| 20 | 20 | foreach ($this->data as $row) { |
| 21 | 21 | /** @var YAxis $row */ |
| 22 | - $rows[] = $row->getArrayCopy(); |
|
| 22 | + $rows[ ] = $row->getArrayCopy(); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | return $rows; |