guzzle/guzzle — pull request #332 by mtdowling (2013-05-29 22:28:47+00:00)
Title: Better interfaces

This PR addresses various issues:

1. Refactors the underlying header implementation of messages
2. Trims down several interfaces to remove implementation specific details
3. Removes a few methods that have been deprecated for several months.
4. Removes unnecessary {@inheritdoc} tags and shortens variable docblocks
5. Marks MonologLogAdapter as deprecated (use the PsrLogAdapter)
6. Changes a few legacy/poor design decisions

# Refactors the underlying header implementation of messages

Headers are now represented using a much simpler and flatter Header object that implements HeaderInterface.
* Mixed casing of headers are now forced to be a single consistent casing across all values for that header.
* Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution
* Removed the whole changedHeader() function system of messages because all header changes now go through addHeader(). For example, setHeader() first removes the header using unset on a HeaderCollection and then calls addHeader(). Keeping the Host header and URL host in sync is now handled by overriding the addHeader method in Request.
* Specific header implementations can be created for complex headers. When a message creates a header, it uses a HeaderFactory which can map specific headers to specific header classes. There is now a Link header and CacheControl header implementation.
* Moved getLinks() from Response to just be used on a Link header object.

If you previously relied on Guzzle\Http\Message\Header::raw(), then you will need to update your code to use the HeaderInterface (e.g. toArray(), getAll(), etc).

# Trims down several interfaces to remove implementation specific details

Moved from interfaces to just a method on a concrete class:
* Guzzle\Http\ClientInterface::setUriTemplate
* Guzzle\Http\ClientInterface::setCurlMulti()

# Removes a few methods that have been deprecated for several months.

* Removed Guzzle\Parser\ParserRegister::get(). Use getParser()
* Removed Guzzle\Parser\ParserRegister::set(). Use registerParser().

# Changes a few legacy/poor design decisions

Updated:
* All response header helper functions return a string rather than mixing Header objects and strings inconsistently

Removed:

* Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc are managed by Guzzle directly via interfaces
* Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string.
* Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in Guzzle\Http\Curl\RequestMediator
* Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface
* Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders()
* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist but are a no-op until removed.

Deprecated:

* The ability to case-insensitively search for header values
* Guzzle\Http\Message\Header::hasExactHeader
* Guzzle\Http\Message\Header::raw. Use getAll()
* Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object instead.

Added:
* Added Guzzle\Http\Message\RequestInterface::startResponse() to handle injecting a response on a request while the request is still being transferred