commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / civicrm / packages / ezc / Mail / src / options / transport_options.php
1 <?php
2 /**
3 * File containing the ezcMailTransportOption class
4 *
5 * @package Mail
6 * @version 1.7beta1
7 * @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
8 * @license http://ez.no/licenses/new_bsd New BSD License
9 */
10
11 /**
12 * Class containing the basic options for mail transports.
13 *
14 * @property int $timeout
15 * Specifies the time in seconds until the connection is closed if
16 * there is no activity through the connection.
17 * @property bool $ssl
18 * Specifies whether to use an SSL connection or not.
19 *
20 * @package Mail
21 * @version 1.7beta1
22 */
23 class ezcMailTransportOptions extends ezcBaseOptions
24 {
25 /**
26 * Constructs an object with the specified values.
27 *
28 * @throws ezcBasePropertyNotFoundException
29 * if $options contains a property not defined
30 * @throws ezcBaseValueException
31 * if $options contains a property with a value not allowed
32 * @param array(string=>mixed) $options
33 */
34 public function __construct( array $options = array() )
35 {
36 $this->timeout = 5; // default value for timeout is 5 seconds
37 $this->ssl = false; // default value for ssl is false
38
39 parent::__construct( $options );
40 }
41
42 /**
43 * Sets the option $name to $value.
44 *
45 * @throws ezcBasePropertyNotFoundException
46 * if the property $name is not defined
47 * @throws ezcBaseValueException
48 * if $value is not correct for the property $name
49 * @param string $name
50 * @param mixed $value
51 * @ignore
52 */
53 public function __set( $name, $value )
54 {
55 switch ( $name )
56 {
57 case 'timeout':
58 if ( !is_numeric( $value ) || ( $value < 1 ) )
59 {
60 throw new ezcBaseValueException( $name, $value, 'int >= 1' );
61 }
62 $this->properties[$name] = (int) $value;
63 break;
64
65 case 'ssl':
66 if ( !is_bool( $value ) )
67 {
68 throw new ezcBaseValueException( $name, $value, 'bool' );
69 }
70 $this->properties[$name] = $value;
71 break;
72
73 default:
74 throw new ezcBasePropertyNotFoundException( $name );
75 }
76 }
77 }
78 ?>