* $options = new ezcMailParserOptions(); * $options->mailClass = 'ezcMail'; * * $parser = new ezcMailParser( $options ); * * * @property int $mailClass * Specifies a class descending from ezcMail which can be returned by the * parser if you plan to use another class instead of ezcMail. * * @package Mail * @version 1.4.1 */ class ezcMailParserOptions extends ezcBaseOptions { /** * Constructs an object with the specified values. * * @throws ezcBasePropertyNotFoundException * if $options contains a property not defined * @throws ezcBaseValueException * if $options contains a property with a value not allowed * @param array(string=>mixed) $options */ public function __construct( array $options = array() ) { $this->mailClass = 'ezcMail'; // default value for mail class is 'ezcMail' parent::__construct( $options ); } /** * 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. * @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. We have to do that with reflection // here unfortunately $parentClass = new ReflectionClass( 'ezcMail' ); $handlerClass = new ReflectionClass( $propertyValue ); if ( 'ezcMail' !== $propertyValue && !$handlerClass->isSubclassOf( $parentClass ) ) { throw new ezcBaseInvalidParentClassException( 'ezcMail', $propertyValue ); } $this->properties[$propertyName] = $propertyValue; break; default: throw new ezcBasePropertyNotFoundException( $propertyName ); } } } ?>