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> <target>docs</target>
</transformer> </transformer>
<transformations> <transformations>
<template name="clean" /> <template name="responsive" />
</transformations> </transformations>
<files> <files>
<directory>src</directory> <directory>src</directory>

View File

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

View File

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

View File

@ -15,24 +15,43 @@ namespace pjdietz\WellRESTed\Interfaces;
*/ */
interface RequestInterface 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(); 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(); 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(); public function getQuery();
/** /**
* Return the value for this header name * Return the value for a given header.
* *
* @param $headerName * Per RFC 2616, HTTP headers are case-insensitive. Take care to conform to
* @return string $headerName * this when implementing.
*
* @param string $headerName Field name of the header
* @return string Header field value
*/ */
public function getHeader($headerName); public function getHeader($headerName);
/** @return string Requst body */ /**
* Return the body of the request.
*
* @return string Request body
*/
public function getBody(); public function getBody();
} }

View File

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