summaryrefslogtreecommitdiffstats
path: root/src/interfaces/axis_label_renderer.php
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-11-02 16:05:45 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-11-02 16:05:45 +0000
commit5bdf51ead2a5e1dfb683c56df48e3d887e743472 (patch)
tree7e39889aca43eff30617df44f5bb567be94035f9 /src/interfaces/axis_label_renderer.php
parent39d55ef60b9074920a1a3fc3d0c0f8d51f303760 (diff)
downloadzetacomponents-graph-5bdf51ead2a5e1dfb683c56df48e3d887e743472.zip
zetacomponents-graph-5bdf51ead2a5e1dfb683c56df48e3d887e743472.tar.gz
- Throw ezcBaseValueExceptions instead of typecasting
- Do range checks instead of converting numbers using min and max - Extended testcases to test for ezcBaseValueExceptions
Diffstat (limited to 'src/interfaces/axis_label_renderer.php')
-rw-r--r--src/interfaces/axis_label_renderer.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/interfaces/axis_label_renderer.php b/src/interfaces/axis_label_renderer.php
index 1a8e295..8df4e27 100644
--- a/src/interfaces/axis_label_renderer.php
+++ b/src/interfaces/axis_label_renderer.php
@@ -88,26 +88,76 @@ abstract class ezcGraphAxisLabelRenderer extends ezcBaseOptions
}
break;
case 'majorStepCount':
+ if ( ( $propertyValue !== false ) &&
+ !is_numeric( $propertyValue ) ||
+ ( $propertyValue < 0 ) )
+ {
+ throw new ezcBaseValueException( $propertyName, $propertyValue, 'int >= 0' );
+ }
+
$this->properties['majorStepCount'] = (int) $propertyValue;
break;
case 'minorStepCount':
+ if ( ( $propertyValue !== false ) &&
+ !is_numeric( $propertyValue ) ||
+ ( $propertyValue < 0 ) )
+ {
+ throw new ezcBaseValueException( $propertyName, $propertyValue, 'int >= 0' );
+ }
+
$this->properties['minorStepCount'] = (int) $propertyValue;
break;
case 'majorStepSize':
+ if ( !is_numeric( $propertyValue ) ||
+ ( $propertyValue < 0 ) )
+ {
+ throw new ezcBaseValueException( $propertyName, $propertyValue, 'int >= 0' );
+ }
+
$this->properties['majorStepSize'] = (int) $propertyValue;
break;
case 'minorStepSize':
+ if ( !is_numeric( $propertyValue ) ||
+ ( $propertyValue < 0 ) )
+ {
+ throw new ezcBaseValueException( $propertyName, $propertyValue, 'int >= 0' );
+ }
+
$this->properties['minorStepSize'] = (int) $propertyValue;
break;
case 'innerStep':
+ if ( !is_bool( $propertyValue ) )
+ {
+ throw new ezcBaseValueException( $propertyName, $propertyValue, 'bool' );
+ }
+
$this->properties['innerStep'] = (bool) $propertyValue;
break;
case 'outerStep':
+ if ( !is_bool( $propertyValue ) )
+ {
+ throw new ezcBaseValueException( $propertyName, $propertyValue, 'bool' );
+ }
+
$this->properties['outerStep'] = (bool) $propertyValue;
break;
case 'outerGrid':
+ if ( !is_bool( $propertyValue ) )
+ {
+ throw new ezcBaseValueException( $propertyName, $propertyValue, 'bool' );
+ }
+
$this->properties['outerGrid'] = (bool) $propertyValue;
break;
+ case 'labelPadding':
+ if ( !is_numeric( $propertyValue ) ||
+ ( $propertyValue < 0 ) )
+ {
+ throw new ezcBaseValueException( $propertyName, $propertyValue, 'int >= 0' );
+ }
+
+ $this->properties['labelPadding'] = (int) $propertyValue;
+ break;
default:
throw new ezcBasePropertyNotFoundException( $propertyName );
}
OpenPOWER on IntegriCloud