@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | public function recursiveToFloat(array $input) |
| 19 | 19 | { |
| 20 | - array_walk_recursive($input, function (&$value) { |
|
| 20 | + array_walk_recursive($input, function(&$value) { |
|
| 21 | 21 | $value = floatval($value); |
| 22 | 22 | }); |
| 23 | 23 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function recursiveToInt(array $input) |
| 33 | 33 | { |
| 34 | - array_walk_recursive($input, function (&$value) { |
|
| 34 | + array_walk_recursive($input, function(&$value) { |
|
| 35 | 35 | $value = intval($value); |
| 36 | 36 | }); |
| 37 | 37 | |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public function recursiveToString(array $input) |
| 18 | 18 | { |
| 19 | - array_walk_recursive($input, function (&$value) { |
|
| 19 | + array_walk_recursive($input, function(&$value) { |
|
| 20 | 20 | $value = strval($value); |
| 21 | 21 | }); |
| 22 | 22 | |
@@ -17,10 +17,10 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | public function getArrayCopy() |
| 19 | 19 | { |
| 20 | - $rows = []; |
|
| 20 | + $rows = [ ]; |
|
| 21 | 21 | foreach ($this->data as $row) { |
| 22 | 22 | /** @var DataSet $row */ |
| 23 | - $rows[] = $row->getArrayCopy(); |
|
| 23 | + $rows[ ] = $row->getArrayCopy(); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | return $rows; |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function jsonSerialize() |
| 33 | 33 | { |
| 34 | - $rows = []; |
|
| 34 | + $rows = [ ]; |
|
| 35 | 35 | foreach ($this->data as $row) { |
| 36 | 36 | /** @var DataSet $row */ |
| 37 | - $rows[] = $row->jsonSerialize(); |
|
| 37 | + $rows[ ] = $row->jsonSerialize(); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | return $rows; |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function jsonSerialize() |
| 19 | 19 | { |
| 20 | - return array_map(function ($value) { |
|
| 20 | + return array_map(function($value) { |
|
| 21 | 21 | if ($value instanceof JsonSerializableInterface) { |
| 22 | 22 | return $value->jsonSerialize(); |
| 23 | 23 | } elseif ($value instanceof ArraySerializableInterface) { |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function getArrayCopy() |
| 20 | 20 | { |
| 21 | - $currentValues = array_map(function ($value) { |
|
| 21 | + $currentValues = array_map(function($value) { |
|
| 22 | 22 | if (is_object($value)) { |
| 23 | 23 | if ($value instanceof ArraySerializableInterface) { |
| 24 | 24 | return $value->getArrayCopy(); |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | }, get_object_vars($this)); |
| 30 | 30 | |
| 31 | 31 | // Filter out null values and return the remaining. |
| 32 | - return array_filter($currentValues, function ($value, $key) { |
|
| 33 | - return ! is_null($value) && $key !== 'owner'; |
|
| 32 | + return array_filter($currentValues, function($value, $key) { |
|
| 33 | + return !is_null($value) && $key !== 'owner'; |
|
| 34 | 34 | }, ARRAY_FILTER_USE_BOTH); |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -22,25 +22,25 @@ |
||
| 22 | 22 | { |
| 23 | 23 | $config = [ |
| 24 | 24 | 'type' => constant(get_class($this->chart) . "::TYPE"), |
| 25 | - 'data' => [], |
|
| 25 | + 'data' => [ ], |
|
| 26 | 26 | ]; |
| 27 | 27 | |
| 28 | 28 | $labels = $this->chart->labels()->jsonSerialize(); |
| 29 | 29 | if ($labels) { |
| 30 | - $config['data']['labels'] = $labels; |
|
| 30 | + $config[ 'data' ][ 'labels' ] = $labels; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $dataSets = $this->chart->dataSets()->jsonSerialize(); |
| 34 | 34 | if ($dataSets) { |
| 35 | - $config['data']['datasets'] = $dataSets; |
|
| 35 | + $config[ 'data' ][ 'datasets' ] = $dataSets; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $options = $this->chart->options()->jsonSerialize(); |
| 39 | - if (! empty($options)) { |
|
| 40 | - $config['options'] = $options; |
|
| 39 | + if (!empty($options)) { |
|
| 40 | + $config[ 'options' ] = $options; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $output = JsonHelper::encode($config, false, ['enableJsonExprFinder' => true]); |
|
| 43 | + $output = JsonHelper::encode($config, false, [ 'enableJsonExprFinder' => true ]); |
|
| 44 | 44 | if ($flags & Renderer::RENDER_PRETTY) { |
| 45 | 45 | $output = JsonHelper::prettyPrint($output); |
| 46 | 46 | } |
@@ -18,15 +18,15 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | public function render($flags = null) |
| 20 | 20 | { |
| 21 | - $script = []; |
|
| 21 | + $script = [ ]; |
|
| 22 | 22 | |
| 23 | 23 | // First, setup the canvas context |
| 24 | - $script[] = "var ctx = document.getElementById( \"{$this->chart->getId()}\" ).getContext( \"2d\" );"; |
|
| 24 | + $script[ ] = "var ctx = document.getElementById( \"{$this->chart->getId()}\" ).getContext( \"2d\" );"; |
|
| 25 | 25 | |
| 26 | 26 | // Now, setup the chart instance |
| 27 | 27 | $jsonRenderer = new Json($this->chart); |
| 28 | 28 | $json = $jsonRenderer->render($flags); |
| 29 | - $script[] = "var chart = new Chart( ctx, {$json} );"; |
|
| 29 | + $script[ ] = "var chart = new Chart( ctx, {$json} );"; |
|
| 30 | 30 | $scriptString = implode("\n", $script); |
| 31 | 31 | |
| 32 | 32 | // Return the script |
@@ -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 | /** @var \Halfpastfour\PHPChartJS\DataSet $dataSet */ |
| 233 | 233 | $dataSet = new $datasetClass(); |
| 234 | 234 | $dataSet->setOwner($this); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | public function options() |
| 243 | 243 | { |
| 244 | 244 | if (is_null($this->options)) { |
| 245 | - $optionsClass = static::MODEL['options']; |
|
| 245 | + $optionsClass = static::MODEL[ 'options' ]; |
|
| 246 | 246 | $this->options = new $optionsClass($this); |
| 247 | 247 | $this->options->setOwner($this); |
| 248 | 248 | } |