Skip to content

Commit 20970c6

Browse files
Jamie LearmonthBilge
authored andcommitted
Added missing accessors and mutators for HTTP and SOAP options (#14).
1 parent 677c2d4 commit 20970c6

4 files changed

Lines changed: 524 additions & 2 deletions

File tree

src/Net/Http/HttpOptions.php

Lines changed: 127 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use ScriptFUSION\Porter\Type\StringType;
66

77
/**
8-
* TODO. Add missing HTTP context option accessors and mutators.
8+
* Encapsulates HTTP stream context options.
99
*/
1010
final class HttpOptions extends EncapsulatedOptions
1111
{
@@ -151,6 +151,132 @@ public function setProxy($proxy)
151151
return $this->set('proxy', "$proxy");
152152
}
153153

154+
/**
155+
* @return string
156+
*/
157+
public function getUserAgent()
158+
{
159+
return $this->get('user_agent');
160+
}
161+
162+
/**
163+
* @param string $userAgent
164+
*
165+
* @return $this
166+
*/
167+
public function setUserAgent($userAgent)
168+
{
169+
return $this->set('user_agent', "$userAgent");
170+
}
171+
172+
/**
173+
* @return bool
174+
*/
175+
public function getFollowLocation()
176+
{
177+
return $this->get('follow_location');
178+
}
179+
180+
/**
181+
* @param bool $followLocation
182+
*
183+
* @return $this
184+
*/
185+
public function setFollowLocation($followLocation)
186+
{
187+
return $this->set('follow_location', (bool)$followLocation);
188+
}
189+
190+
/**
191+
* @return bool
192+
*/
193+
public function getRequestFullUri()
194+
{
195+
return $this->get('request_fulluri');
196+
}
197+
198+
/**
199+
* @param bool $requestFullUri
200+
*
201+
* @return $this
202+
*/
203+
public function setRequestFullUri($requestFullUri)
204+
{
205+
return $this->set('request_fulluri', (bool)$requestFullUri);
206+
}
207+
208+
/**
209+
* @return int
210+
*/
211+
public function getMaxRedirects()
212+
{
213+
return $this->get('max_redirects');
214+
}
215+
216+
/**
217+
* @param int $maxRedirects
218+
*
219+
* @return $this
220+
*/
221+
public function setMaxRedirects($maxRedirects)
222+
{
223+
return $this->set('max_redirects', $maxRedirects|0);
224+
}
225+
226+
/**
227+
* @return float
228+
*/
229+
public function getProtocolVersion()
230+
{
231+
return $this->get('protocol_version');
232+
}
233+
234+
/**
235+
* @param float $protocolVersion
236+
*
237+
* @return $this
238+
*/
239+
public function setProtocolVersion($protocolVersion)
240+
{
241+
return $this->set('protocol_version', (float)$protocolVersion);
242+
}
243+
244+
/**
245+
* @return float
246+
*/
247+
public function getTimeout()
248+
{
249+
return $this->get('timeout');
250+
}
251+
252+
/**
253+
* @param float $timeout
254+
*
255+
* @return $this
256+
*/
257+
public function setTimeout($timeout)
258+
{
259+
return $this->set('timeout', (float)$timeout);
260+
}
261+
262+
/**
263+
* @return bool
264+
*/
265+
public function getIgnoreErrors()
266+
{
267+
return $this->get('ignore_errors');
268+
}
269+
270+
/**
271+
* @param bool $ignoreErrors
272+
*
273+
* @return $this
274+
*/
275+
public function setIgnoreErrors($ignoreErrors)
276+
{
277+
return $this->set('ignore_errors', (bool)$ignoreErrors);
278+
}
279+
154280
/**
155281
* Extracts a list of HTTP context options only.
156282
*

0 commit comments

Comments
 (0)