/** * @param array $vars * @param array $args */ function __construct($vars = array(), $args = array()) { if (is_null($vars)) { $vars = array(); } if (is_null($args)) { $args = array(); } else { if (is_string($args)) { $args = RESTian::parse_args($args); } } /** * Copy properties in from $args, if they exist. */ foreach ($args as $property => $value) { if (property_exists($this, $property)) { $this->{$property} = $value; } } /** * Do these late $args cannot override them. */ if (isset($this->service->client)) { $this->client = $this->service->client; } if (isset($args['credentials'])) { $this->set_credentials($args['credentials']); } if (isset($args['grant'])) { $this->set_grant($args['grant']); } if (isset($args['headers'])) { $this->add_headers($args['headers']); } if (is_array($vars)) { $this->vars = $vars; } else { $this->body = $vars; } }
/** * Register a settings * * @param string $settings_name * @param array|string $args */ function register_settings($settings_name, $args) { $this->_settings[$settings_name] = new RESTian_Settings($settings_name, RESTian::parse_args($args)); }