Skip to content

Instantly share code, notes, and snippets.

@jm42
Created September 15, 2014 15:46
Show Gist options
  • Save jm42/e60feac33f0ffa23be22 to your computer and use it in GitHub Desktop.
Save jm42/e60feac33f0ffa23be22 to your computer and use it in GitHub Desktop.
HTTP Interfaces
<?php
namespace Aix\HTTP;
interface Request
{
const METHOD_GET = 'GET';
const METHOD_HEAD = 'HEAD';
const METHOD_POST = 'POST';
const METHOD_PUT = 'PUT';
const METHOD_PATCH = 'PATCH';
const METHOD_DELETE = 'DELETE';
const METHOD_OPTIONS = 'OPTIONS';
public function getMethod();
public function getURI();
public function getHeaders();
public function getBody();
public function getQuery();
public function getForm();
}
interface Response
{
public function getStatus();
public function setStatus($code, $reason=null, $protocol=null);
public function getHeaders();
public function setHeaders(array $headers);
public function getBody();
public function setBody($content=null);
}
interface Client
{
public function getIP();
public function getUserAgent();
public function getReferer();
}
class Server
{
public function getName();
public function getPort();
}
interface Header
{
public function getName();
public function getValue();
}
namespace Aix\HTTP\Request;
use ArrayAccess;
use Countable;
use Serializable;
use Traversable;
interface Parameters extends ArrayAccess, Countable, Serializable, Traversable
{
}
interface Form extends Parameters
{
public function getFiles();
}
interface File
{
public function getName();
public function getType();
public function getSize();
public function getTempName();
public function getError();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment