6.0.0-git
2019-03-22

[#10955] Create seams for customizing settings on Horde_Http_Request objects
Summary Create seams for customizing settings on Horde_Http_Request objects
Queue Horde Framework Packages
Queue Version Git master
Type Enhancement
State Accepted
Priority 1. Low
Owners
Requester bob (at) bluestatedigital (dot) com
Created 2012-02-01 (2606 days ago)
Due
Updated 2016-01-18 (1159 days ago)
Assigned
Resolved
Milestone
Patch No

History
2016-01-18 15:37:36 Jan Schneider State ⇒ Accepted
 
2012-02-01 16:31:11 bob (at) bluestatedigital (dot) com Comment #1
Type ⇒ Enhancement
State ⇒ New
Priority ⇒ 1. Low
Summary ⇒ Create seams for customizing settings on Horde_Http_Request objects
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ No
Reply to this comment
The stream context options on Horde_Http_Request_Fopen and curl 
options on Horde_Http_Request_Curl options are inaccessible.  There 
are no seams to modify them without creating a new class, copy/pasting 
the oversized send() method and apply customization within.  This 
leads to unnecessary work the next time you try to upgrade the 
underlying Horde libs.

The quickest solution is to extract the initialization of $opts and 
$curl into a protected method.  This would allow deveopers to extend 
the class, overwrite the method, and add or modify options before 
returning the value to send() for usage.

If publishing protected methods like this in a public project is not 
desirable you could possibly create an options Builder (meaning 
Builder Pattern) which could be injected.  The Builder could have 
methods like setProxy($host, $port), setAuth($scheme, $username, 
$password), and of course a build()/make()/create() method that 
returns the assembled object.  The Builder could be extended by 
developers to add more options at any stage of the building process.

Saved Queries