properties['label'] = '%1$s: %2$d (%3$.1f%%)'; $this->properties['labelCallback'] = null; $this->properties['sum'] = false; $this->properties['percentTreshHold'] = .0; $this->properties['absoluteTreshHold'] = .0; $this->properties['summarizeCaption'] = 'Misc'; parent::__construct( $options ); } /** * Set an option value * * @param string $propertyName * @param mixed $propertyValue * @throws ezcBasePropertyNotFoundException * If a property is not defined in this class * @return void * @ignore */ public function __set( $propertyName, $propertyValue ) { switch ( $propertyName ) { case 'label': $this->properties['label'] = (string) $propertyValue; break; case 'labelCallback': if ( is_string( $propertyValue ) && ezcBaseFeatures::hasFunction( $propertyValue ) ) { $this->properties['labelCallback'] = $propertyValue; } else { throw new ezcBaseValueException( $propertyName, $propertyValue, 'callback function' ); } break; case 'sum': if ( !is_numeric( $propertyValue ) || ( $propertyValue <= 0 ) ) { throw new ezcBaseValueException( $propertyName, $propertyValue, 'float > 0' ); } $this->properties['sum'] = (float) $propertyValue; break; case 'percentTreshHold': if ( !is_numeric( $propertyValue ) || ( $propertyValue < 0 ) || ( $propertyValue > 1 ) ) { throw new ezcBaseValueException( $propertyName, $propertyValue, '0 <= float <= 1' ); } $this->properties['percentTreshHold'] = (float) $propertyValue; break; case 'absoluteTreshHold': if ( !is_numeric( $propertyValue ) || ( $propertyValue <= 0 ) ) { throw new ezcBaseValueException( $propertyName, $propertyValue, 'float > 0' ); } $this->properties['absoluteTreshHold'] = (float) $propertyValue; break; case 'summarizeCaption': $this->properties['summarizeCaption'] = (string) $propertyValue; break; default: return parent::__set( $propertyName, $propertyValue ); } } } ?>