Skip to content

Instantly share code, notes, and snippets.

@denixport
Created July 20, 2012 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save denixport/3153907 to your computer and use it in GitHub Desktop.
Save denixport/3153907 to your computer and use it in GitHub Desktop.
ZF2 HTTP interfaces proposal
<?php
namespace Zend\Http;
interface ClientInterface
{
/**
* @param Request $request
* @return Response $response
*/
public function send(Request $request);
}
<?php
namespace Zend\Http;
interface RequestInterface
{
/**
* @param string|\Zend\Uri\Http $uri
*/
public function setUri($uri);
/**
* @param string
*/
public function setMethod($method);
/**
* @param array|\Zend\Http\Headers
*/
public function setHeaders($headers);
/**
* @param string
*/
public function setBody($body);
public function __toString();
}
interface ResponseInterface
{
/**
* @return int
*/
public function getStatusCode();
/**
* @return \Zend\Http\Headers
*/
public function getHeaders();
/**
* @param string
*/
public function getBody();
public function __toString();
}
interface ClientInterface
{
/**
* @param RequestInterface $request
* @return ResponseInterface $response
*/
public function send(RequestInterface $request);
}
<?php
namespace Zend\Http;
interface StaticClientInterface
{
/**
* @return ClientInterface
*/
public static function getClient()
/**
* @param string $method
* @param string|\Zend\Uri\Http $uri
* @param array|\Zend\Http\Headers $headers
* @param string|null $body
* @return Response
*/
public static function request($method, $uri, $headers = array(), $body = null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment