colorIndex = -1; $this->symbolIndex = -1; } /** * Returns the requested property * * @param string $propertyName Name of property * @return mixed * @ignore */ public function __get( $propertyName ) { switch ( $propertyName ) { case 'axisColor': case 'majorGridColor': case 'minorGridColor': case 'fontColor': case 'chartBackground': case 'chartBorderColor': case 'elementBackground': case 'elementBorderColor': return ( $this->$propertyName = $this->checkColor( $this->$propertyName ) ); case 'dataSetColor': $this->colorIndex = ( ( $this->colorIndex + 1 ) % count( $this->dataSetColor ) ); return $this->checkColor( $this->dataSetColor[ $this->colorIndex ] ); case 'dataSetSymbol': $this->symbolIndex = ( ( $this->symbolIndex + 1 ) % count( $this->dataSetSymbol ) ); return $this->dataSetSymbol[ $this->symbolIndex ]; case 'fontName': case 'chartBorderWidth': case 'elementBorderWidth': case 'padding': case 'margin': return $this->$propertyName; default: throw new ezcBasePropertyNotFoundException( $propertyName ); } } /** * __set * * @param mixed $propertyName Property name * @param mixed $propertyValue Property value * @access public * @ignore */ public function __set( $propertyName, $propertyValue ) { switch ( $propertyName ) { case 'axisColor': case 'majorGridColor': case 'minorGridColor': case 'fontColor': case 'chartBackground': case 'chartBorderColor': case 'elementBackground': case 'elementBorderColor': $this->$propertyName = ezcGraphColor::create( $propertyValue ); break; case 'dataSetColor': if ( !is_array( $propertyValue ) ) { throw new ezcBaseValueException( $propertyName, $propertyValue, 'array( ezcGraphColor )' ); } $this->dataSetColor = array(); foreach ( $propertyValue as $value ) { $this->dataSetColor[] = ezcGraphColor::create( $value ); } $this->colorIndex = -1; break; case 'dataSetSymbol': if ( !is_array( $propertyValue ) ) { throw new ezcBaseValueException( $propertyName, $propertyValue, 'array( (int) ezcGraph::SYMBOL_TYPE )' ); } $this->dataSetSymbol = array(); foreach ( $propertyValue as $value ) { $this->dataSetSymbol[] = (int) $value; } $this->symbolIndex = -1; break; case 'fontName': $this->$propertyName = (string) $propertyValue; break; case 'chartBorderWidth': case 'elementBorderWidth': case 'padding': case 'margin': if ( !is_numeric( $propertyValue ) || ( $propertyValue < 0 ) ) { throw new ezcBaseValueException( $propertyName, $propertyValue, 'int >= 0' ); } $this->$propertyName = (int) $propertyValue; break; default: throw new ezcBasePropertyNotFoundException( $propertyName ); } } } ?>