@@ -22,7 +22,9 @@ discard block |
||
| 22 | 22 | $reflectionClass = new \Zend_Reflection_Class( $this ); |
| 23 | 23 | foreach( $properties as $property => $value ) { |
| 24 | 24 | // Skip property if it is not accessible |
| 25 | - if( !$reflectionClass->hasProperty( $property ) ) continue; |
|
| 25 | + if( !$reflectionClass->hasProperty( $property ) ) { |
|
| 26 | + continue; |
|
| 27 | + } |
|
| 26 | 28 | |
| 27 | 29 | // Only process properties that aren't null |
| 28 | 30 | if( !is_null( $value ) ) { |
@@ -33,7 +35,9 @@ discard block |
||
| 33 | 35 | |
| 34 | 36 | // Prepend 'get' to the getter method. |
| 35 | 37 | $getter = 'get' . ucfirst( $property ); |
| 36 | - if( is_object( $value ) && !$this->$property instanceof Expr ) $object = true; |
|
| 38 | + if( is_object( $value ) && !$this->$property instanceof Expr ) { |
|
| 39 | + $object = true; |
|
| 40 | + } |
|
| 37 | 41 | |
| 38 | 42 | // Determine whether the getter method is equal to the property name or is prepended by 'is' or 'get' |
| 39 | 43 | if( strcmp( $type, 'bool' ) === 0 || strcmp( $type, 'boolean' ) === 0 ) { |
@@ -46,7 +50,9 @@ discard block |
||
| 46 | 50 | } |
| 47 | 51 | |
| 48 | 52 | // Abort if the method does not exist |
| 49 | - if( !method_exists( $this, $getter ) ) continue; |
|
| 53 | + if( !method_exists( $this, $getter ) ) { |
|
| 54 | + continue; |
|
| 55 | + } |
|
| 50 | 56 | |
| 51 | 57 | // Assign the contents of the property to the data array |
| 52 | 58 | $data[ $property ] = $object ? $this->$getter()->getArrayCopy() : $this->$getter(); |
@@ -182,8 +182,12 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | public function setBackgroundColor( $backgroundColor ) |
| 184 | 184 | { |
| 185 | - if( is_array( $backgroundColor ) ) $backgroundColor = array_map( 'strval',$backgroundColor ); |
|
| 186 | - if( !is_array( $backgroundColor ) ) $backgroundColor = strval( $backgroundColor ); |
|
| 185 | + if( is_array( $backgroundColor ) ) { |
|
| 186 | + $backgroundColor = array_map( 'strval',$backgroundColor ); |
|
| 187 | + } |
|
| 188 | + if( !is_array( $backgroundColor ) ) { |
|
| 189 | + $backgroundColor = strval( $backgroundColor ); |
|
| 190 | + } |
|
| 187 | 191 | |
| 188 | 192 | $this->backgroundColor = $backgroundColor; |
| 189 | 193 | |
@@ -205,8 +209,12 @@ discard block |
||
| 205 | 209 | */ |
| 206 | 210 | public function setBorderColor( $borderColor ) |
| 207 | 211 | { |
| 208 | - if( is_array( $borderColor ) ) $borderColor = array_map( 'strval', $borderColor ); |
|
| 209 | - if( !is_array( $borderColor ) ) $borderColor = strval( $borderColor ); |
|
| 212 | + if( is_array( $borderColor ) ) { |
|
| 213 | + $borderColor = array_map( 'strval', $borderColor ); |
|
| 214 | + } |
|
| 215 | + if( !is_array( $borderColor ) ) { |
|
| 216 | + $borderColor = strval( $borderColor ); |
|
| 217 | + } |
|
| 210 | 218 | |
| 211 | 219 | $this->borderColor = $borderColor; |
| 212 | 220 | |
@@ -228,8 +236,12 @@ discard block |
||
| 228 | 236 | */ |
| 229 | 237 | public function setBorderWidth( $borderWidth ) |
| 230 | 238 | { |
| 231 | - if( is_array( $borderWidth ) ) $borderWidth = array_map( 'intval', $borderWidth ); |
|
| 232 | - if( !is_array( $borderWidth ) ) $borderWidth = intval( $borderWidth ); |
|
| 239 | + if( is_array( $borderWidth ) ) { |
|
| 240 | + $borderWidth = array_map( 'intval', $borderWidth ); |
|
| 241 | + } |
|
| 242 | + if( !is_array( $borderWidth ) ) { |
|
| 243 | + $borderWidth = intval( $borderWidth ); |
|
| 244 | + } |
|
| 233 | 245 | |
| 234 | 246 | $this->borderWidth = $borderWidth; |
| 235 | 247 | |
@@ -271,8 +283,12 @@ discard block |
||
| 271 | 283 | */ |
| 272 | 284 | public function setHoverBackgroundColor( $hoverBackgroundColor ) |
| 273 | 285 | { |
| 274 | - if( is_array( $hoverBackgroundColor ) ) $hoverBackgroundColor = array_map( 'strval', $hoverBackgroundColor ); |
|
| 275 | - if( !is_array( $hoverBackgroundColor ) ) $hoverBackgroundColor = strval( $hoverBackgroundColor ); |
|
| 286 | + if( is_array( $hoverBackgroundColor ) ) { |
|
| 287 | + $hoverBackgroundColor = array_map( 'strval', $hoverBackgroundColor ); |
|
| 288 | + } |
|
| 289 | + if( !is_array( $hoverBackgroundColor ) ) { |
|
| 290 | + $hoverBackgroundColor = strval( $hoverBackgroundColor ); |
|
| 291 | + } |
|
| 276 | 292 | |
| 277 | 293 | $this->hoverBackgroundColor = $hoverBackgroundColor; |
| 278 | 294 | |
@@ -294,8 +310,12 @@ discard block |
||
| 294 | 310 | */ |
| 295 | 311 | public function setHoverBorderColor( $hoverBorderColor ) |
| 296 | 312 | { |
| 297 | - if( is_array( $hoverBorderColor ) ) $hoverBorderColor = array_map( 'strval', $hoverBorderColor ); |
|
| 298 | - if( !is_array( $hoverBorderColor ) ) $hoverBorderColor = strval( $hoverBorderColor ); |
|
| 313 | + if( is_array( $hoverBorderColor ) ) { |
|
| 314 | + $hoverBorderColor = array_map( 'strval', $hoverBorderColor ); |
|
| 315 | + } |
|
| 316 | + if( !is_array( $hoverBorderColor ) ) { |
|
| 317 | + $hoverBorderColor = strval( $hoverBorderColor ); |
|
| 318 | + } |
|
| 299 | 319 | |
| 300 | 320 | $this->hoverBorderColor = $hoverBorderColor; |
| 301 | 321 | |
@@ -317,8 +337,12 @@ discard block |
||
| 317 | 337 | */ |
| 318 | 338 | public function setHoverBorderWidth( $hoverBorderWidth ) |
| 319 | 339 | { |
| 320 | - if( is_array( $hoverBorderWidth ) ) $hoverBorderWidth = array_map( 'intval', $hoverBorderWidth ); |
|
| 321 | - if( !is_array( $hoverBorderWidth ) ) $hoverBorderWidth = intval( $hoverBorderWidth ); |
|
| 340 | + if( is_array( $hoverBorderWidth ) ) { |
|
| 341 | + $hoverBorderWidth = array_map( 'intval', $hoverBorderWidth ); |
|
| 342 | + } |
|
| 343 | + if( !is_array( $hoverBorderWidth ) ) { |
|
| 344 | + $hoverBorderWidth = intval( $hoverBorderWidth ); |
|
| 345 | + } |
|
| 322 | 346 | |
| 323 | 347 | $this->hoverBorderWidth = $hoverBorderWidth; |
| 324 | 348 | |
@@ -25,16 +25,24 @@ |
||
| 25 | 25 | ]; |
| 26 | 26 | |
| 27 | 27 | $labels = $this->chart->labels()->getArrayCopy(); |
| 28 | - if( $labels ) $config['data']['labels'] = $labels; |
|
| 28 | + if( $labels ) { |
|
| 29 | + $config['data']['labels'] = $labels; |
|
| 30 | + } |
|
| 29 | 31 | |
| 30 | 32 | $dataSets = $this->chart->dataSets()->getArrayCopy(); |
| 31 | - if( $dataSets ) $config['data']['datasets'] = $dataSets; |
|
| 33 | + if( $dataSets ) { |
|
| 34 | + $config['data']['datasets'] = $dataSets; |
|
| 35 | + } |
|
| 32 | 36 | |
| 33 | 37 | $options = $this->chart->options()->getArrayCopy(); |
| 34 | - if( $options ) $config['options'] = $options; |
|
| 38 | + if( $options ) { |
|
| 39 | + $config['options'] = $options; |
|
| 40 | + } |
|
| 35 | 41 | |
| 36 | 42 | $output = JsonHelper::encode( $config, false, [ 'enableJsonExprFinder' => true ] ); |
| 37 | - if( $flags & Renderer::RENDER_PRETTY ) $output = JsonHelper::prettyPrint( $output ); |
|
| 43 | + if( $flags & Renderer::RENDER_PRETTY ) { |
|
| 44 | + $output = JsonHelper::prettyPrint( $output ); |
|
| 45 | + } |
|
| 38 | 46 | |
| 39 | 47 | return $output; |
| 40 | 48 | } |
@@ -24,9 +24,15 @@ |
||
| 24 | 24 | $canvas->setAttribute( 'id', $this->chart->getId() ); |
| 25 | 25 | |
| 26 | 26 | // Add title, height and width if applicable |
| 27 | - if( $this->chart->getTitle() ) $canvas->setAttribute( 'title', $this->chart->getTitle() ); |
|
| 28 | - if( $this->chart->getHeight() ) $canvas->setAttribute( 'height', $this->chart->getHeight() ); |
|
| 29 | - if( $this->chart->getWidth() ) $canvas->setAttribute( 'width', $this->chart->getWidth() ); |
|
| 27 | + if( $this->chart->getTitle() ) { |
|
| 28 | + $canvas->setAttribute( 'title', $this->chart->getTitle() ); |
|
| 29 | + } |
|
| 30 | + if( $this->chart->getHeight() ) { |
|
| 31 | + $canvas->setAttribute( 'height', $this->chart->getHeight() ); |
|
| 32 | + } |
|
| 33 | + if( $this->chart->getWidth() ) { |
|
| 34 | + $canvas->setAttribute( 'width', $this->chart->getWidth() ); |
|
| 35 | + } |
|
| 30 | 36 | |
| 31 | 37 | $dom->appendChild( $canvas ); |
| 32 | 38 | |