1: <?php
2:
3: class RESTian_Settings {
4:
5: /**
6: * @var string
7: */
8: var $settings_name;
9:
10: /**
11: * @var string HTTP Method
12: */
13: var $http_method;
14:
15: /**
16: * @var string Content Type used on the Body of a POST or PUT
17: */
18: var $content_type;
19:
20: /**
21: * @var string character set used
22: */
23: var $charset;
24:
25: function __construct( $settings_name, $args = array() ) {
26:
27: $this->modifier_name = $settings_name;
28:
29: if ( ! is_object( $args ) && ! is_array( $args ) ) {
30: throw new Exception( 'Must pass a string, array or object for $args when creating a new ' . __CLASS__ . '.' );
31: }
32:
33: $args = RESTian::expand_shortnames( $args, array(
34: 'method' => 'http_method',
35: 'type' => 'content_type',
36: ));
37:
38: if ( isset( $args['content_type'] ) )
39: $args['content_type'] = RESTian::expand_content_type( $args['content_type'] );
40:
41: /**
42: * Copy properties in from $args, if they exist.
43: */
44: foreach( $args as $property => $value )
45: if ( property_exists( $this, $property ) )
46: $this->$property = $value;
47:
48: }
49:
50: }
51: