Fix phpdoc for interfaces, Handler.

This commit is contained in:
PJ Dietz 2014-07-13 10:12:12 -04:00
parent 3be61bfb07
commit aec8bcca4a
5 changed files with 70 additions and 25 deletions

View File

@ -12,7 +12,7 @@
<target>docs</target>
</transformer>
<transformations>
<template name="clean" />
<template name="responsive" />
</transformations>
<files>
<directory>src</directory>

View File

@ -19,11 +19,11 @@ use pjdietz\WellRESTed\Interfaces\RequestInterface;
* Responds to a request based on the HTTP method.
*
* To use Handler, create a subclass and implement the methods for any HTTP
* verbs you would like to support. (`get()` for GET, `post()` for POST, etc).
*
* - Access the request via the protected member `$this->request`
* - Access a map of arguments via `$this->args` (e.g., URI path variables)
* - Modify `$this->response` to provide the response the instance will return
* verbs you would like to support. (get() for GET, post() for POST, etc).
* <br /><br />
* - Access the request via the protected member $this->request<br />
* - Access a map of arguments via $this->args (e.g., URI path variables)<br />
* - Modify $this->response to provide the response the instance will return<br />
*/
abstract class Handler implements HandlerInterface
{

View File

@ -16,9 +16,11 @@ namespace pjdietz\WellRESTed\Interfaces;
interface HandlerInterface {
/**
* @param RequestInterface $request The request to build a response for.
* @param array|null $args Optional map of arguments.
* @return ResponseInterface|null A response, or null if this handler will not handle.
* Return the handled response.
*
* @param RequestInterface $request The request to respond to.
* @param array|null $args Optional additional arguments.
* @return ResponseInterface The handled response.
*/
public function getResponse(RequestInterface $request, array $args = null);

View File

@ -15,24 +15,43 @@ namespace pjdietz\WellRESTed\Interfaces;
*/
interface RequestInterface
{
/** @return string HTTP request method (e.g., GET, POST, PUT). */
/**
* Return the HTTP verb (e.g., GET, POST, PUT).
*
* @return string Request verb
*/
public function getMethod();
/** @return string Path component of the request URI */
/**
* Return path component of the request URI.
*
* @return string Path component
*/
public function getPath();
/** @return array Query paramters as key-value pairs */
/**
* Return an associative array of query paramters.
*
* @return array Query paramters
*/
public function getQuery();
/**
* Return the value for this header name
* Return the value for a given header.
*
* @param $headerName
* @return string $headerName
* Per RFC 2616, HTTP headers are case-insensitive. Take care to conform to
* this when implementing.
*
* @param string $headerName Field name of the header
* @return string Header field value
*/
public function getHeader($headerName);
/** @return string Requst body */
/**
* Return the body of the request.
*
* @return string Request body
*/
public function getBody();
}

View File

@ -15,30 +15,54 @@ namespace pjdietz\WellRESTed\Interfaces;
*/
interface ResponseInterface
{
/** @return int HTTP status code */
/**
* Return the HTTP status code
*
* @return int HTTP status code
*/
public function getStatusCode();
/** @param int $statusCode HTTP status code */
/**
* Set the status code for the response.
*
* @param int $statusCode HTTP status code
*/
public function setStatusCode($statusCode);
/**
* Return the value for this header name
* Return the value for a given header.
*
* @param $headerName
* @return string $headerName
* Per RFC 2616, HTTP headers are case-insensitive. Take care to conform to
* this when implementing.
*
* @param string $headerName Field name of the header
* @return string Header field value
*/
public function getHeader($headerName);
/**
* @param string $headerName
* @param string $headerValue
* Set the value for a given header.
*
* Per RFC 2616, HTTP headers are case-insensitive. Take care to conform to
* this when implementing.
*
* @param string $headerName Field name
* @param string $headerValue Field value
*/
public function setHeader($headerName, $headerValue);
/** @return string */
/**
* Return the body of the response.
*
* @return string Response body
*/
public function getBody();
/** @param string $body */
/**
* Set the body of the response.
*
* @param string $body Response body
*/
public function setBody($body);
/** Issue the reponse to the client. */