public function __set($strName, $mixValue) { $this->blnModified = true; switch ($strName) { // APPEARANCE case "ScaleCanvasDown": try { $this->blnScaleCanvasDown = QType::Cast($mixValue, QType::Boolean); break; } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case "ScaleImageUp": try { $this->blnScaleImageUp = QType::Cast($mixValue, QType::Boolean); break; } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } // BEHAVIOR // BEHAVIOR case "ImageType": try { $this->strImageType = QType::Cast($mixValue, QType::String); break; } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case "Quality": try { $this->intQuality = QType::Cast($mixValue, QType::Integer); break; } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case "CacheFolder": try { $this->strCacheFolder = QType::Cast($mixValue, QType::String); break; } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case "CacheFilename": try { $this->strCacheFilename = QType::Cast($mixValue, QType::String); break; } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case "ImagePath": try { $this->strImagePath = QType::Cast($mixValue, QType::String); if (!$this->strImagePath || !is_file($this->strImagePath)) { throw new QCallerException('ImagePath is not defined or does not exist'); } $this->strImagePath = realpath($this->strImagePath); break; } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case "AlternateText": try { $this->strAlternateText = QType::Cast($mixValue, QType::String); break; } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } // OVERRIDDEN SETTERS // OVERRIDDEN SETTERS case "BackColor": try { $mixValue = strtolower(QType::Cast($mixValue, QType::String)); } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } if (strlen($mixValue) != 6) { throw new QInvalidCastException('BackColor must be a 6-digit hexadecimal value'); } // Verify ControlId is only Hexadecimal Digits $strMatches = array(); $strPattern = '/[a-f0-9]*/'; preg_match($strPattern, $mixValue, $strMatches); if (count($strMatches) && $strMatches[0] == $mixValue) { return $this->strBackColor = $mixValue; } else { throw new QInvalidCastException('BackColor must be a 6-digit hexadecimal value'); } break; case "Width": try { $this->strWidth = QType::Cast($mixValue, QType::Integer); break; } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case "Height": try { $this->strHeight = QType::Cast($mixValue, QType::Integer); break; } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } default: try { parent::__set($strName, $mixValue); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } break; } }