1: <?php
2: 3: 4: 5: 6: 7: 8: 9:
10:
11: 12: 13: 14: 15: 16:
17: abstract class Horde_Http_Request_Base
18: {
19: 20: 21: 22:
23: protected = array();
24:
25: 26: 27:
28: protected $_options = array();
29:
30: 31: 32:
33: public function __construct($options = array())
34: {
35: $this->setOptions($options);
36: }
37:
38: public function setOptions($options = array())
39: {
40: $this->_options = array_merge($this->getDefaultOptions(), $options);
41: }
42:
43: public function getDefaultOptions()
44: {
45: return array(
46: 'uri' => null,
47: 'method' => 'GET',
48: 'data' => null,
49: 'username' => '',
50: 'password' => '',
51: 'authenticationScheme' => Horde_Http::AUTH_ANY,
52: 'proxyServer' => null,
53: 'proxyPort' => null,
54: 'proxyType' => Horde_Http::PROXY_HTTP,
55: 'proxyUsername' => null,
56: 'proxyPassword' => null,
57: 'proxyAuthenticationScheme' => Horde_Http::AUTH_BASIC,
58: 'timeout' => 5,
59: 'redirects' => 5,
60: );
61: }
62:
63: 64: 65: 66: 67:
68: abstract public function send();
69:
70: 71: 72: 73: 74: 75:
76: public function __get($name)
77: {
78: switch ($name) {
79: case 'headers':
80: return $this->_headers;
81: }
82:
83: return isset($this->_options[$name]) ? $this->_options[$name] : null;
84: }
85:
86: 87: 88: 89: 90: 91:
92: public function __set($name, $value)
93: {
94: switch ($name) {
95: case 'headers':
96: $this->setHeaders($value);
97: break;
98: }
99:
100: $this->_options[$name] = $value;
101: }
102:
103: 104: 105: 106: 107: 108:
109: public function ($headers, $value = null)
110: {
111: if (!is_array($headers)) {
112: $headers = array($headers => $value);
113: }
114:
115: foreach ($headers as $header => $value) {
116: $this->_headers[$header] = $value;
117: }
118: }
119:
120: 121: 122: 123: 124: 125:
126: public function ($header)
127: {
128: return isset($this->_headers[$header]) ? $this->_headers[$header] : null;
129: }
130: }
131: