Beispiel #1
0
 /**
  * Sets the option $propertyName to $propertyValue.
  *
  * @throws ezcBasePropertyNotFoundException
  *         if the property $propertyName is not defined
  * @throws ezcBaseValueException
  *         if $propertyValue is not correct for the property $propertyName
  * @throws ezcBaseInvalidParentClassException
  *         if the class name passed as replacement mailClass does not
  *         inherit from ezcMail.
  * @throws ezcBaseInvalidParentClassException
  *         if the class name passed as replacement fileClass does not
  *         inherit from ezcMailFile.
  * @param string $propertyName
  * @param mixed  $propertyValue
  * @ignore
  */
 public function __set($propertyName, $propertyValue)
 {
     switch ($propertyName) {
         case 'mailClass':
             if (!is_string($propertyValue)) {
                 throw new ezcBaseValueException($propertyName, $propertyValue, 'string that contains a class name');
             }
             // Check if the passed classname actually implements the
             // correct parent class.
             if ('ezcMail' !== $propertyValue && !in_array('ezcMail', class_parents($propertyValue))) {
                 throw new ezcBaseInvalidParentClassException('ezcMail', $propertyValue);
             }
             $this->properties[$propertyName] = $propertyValue;
             break;
         case 'fileClass':
             if (!is_string($propertyValue)) {
                 throw new ezcBaseValueException($propertyName, $propertyValue, 'string that contains a class name');
             }
             // Check if the passed classname actually implements the
             // correct parent class.
             if ('ezcMailFile' !== $propertyValue && !in_array('ezcMailFile', class_parents($propertyValue))) {
                 throw new ezcBaseInvalidParentClassException('ezcMailFile', $propertyValue);
             }
             $this->properties[$propertyName] = $propertyValue;
             ezcMailFileParser::$fileClass = $propertyValue;
             break;
         case 'parseTextAttachmentsAsFiles':
             if (!is_bool($propertyValue)) {
                 throw new ezcBaseValueException($propertyName, $propertyValue, 'bool');
             }
             $this->properties[$propertyName] = $propertyValue;
             ezcMailPartParser::$parseTextAttachmentsAsFiles = $propertyValue;
             break;
         default:
             throw new ezcBasePropertyNotFoundException($propertyName);
     }
 }