AppFramework(Controller|HTTP|HTTP-Responses|Middleware), IContainer API fixes

This commit is contained in:
Morris Jobke 2013-11-25 16:28:24 +01:00
parent 248eed16a6
commit bc8cc9142e
7 changed files with 58 additions and 4 deletions

View File

@ -20,6 +20,10 @@
* *
*/ */
/**
* Public interface of ownCloud for apps to use.
* AppFramework\Controller class
*/
namespace OCP\AppFramework; namespace OCP\AppFramework;
@ -34,16 +38,19 @@ use OCP\IRequest;
abstract class Controller { abstract class Controller {
/** /**
* app container for dependency injection
* @var \OCP\AppFramework\IAppContainer * @var \OCP\AppFramework\IAppContainer
*/ */
protected $app; protected $app;
/** /**
* current request
* @var \OCP\IRequest * @var \OCP\IRequest
*/ */
protected $request; protected $request;
/** /**
* constructor of the controller
* @param IAppContainer $app interface to the app * @param IAppContainer $app interface to the app
* @param IRequest $request an instance of the request * @param IRequest $request an instance of the request
*/ */

View File

@ -20,10 +20,16 @@
* *
*/ */
/**
* Public interface of ownCloud for apps to use.
* AppFramework\HTTP class
*/
namespace OCP\AppFramework; namespace OCP\AppFramework;
/**
* Base class which contains constants for HTTP status codes
*/
class Http { class Http {
const STATUS_CONTINUE = 100; const STATUS_CONTINUE = 100;

View File

@ -20,6 +20,10 @@
* *
*/ */
/**
* Public interface of ownCloud for apps to use.
* AppFramework\HTTP\JSONResponse class
*/
namespace OCP\AppFramework\Http; namespace OCP\AppFramework\Http;
@ -30,10 +34,15 @@ use OCP\AppFramework\Http;
*/ */
class JSONResponse extends Response { class JSONResponse extends Response {
/**
* response data
* @var array|object
*/
protected $data; protected $data;
/** /**
* constructor of JSONResponse
* @param array|object $data the object or array that should be transformed * @param array|object $data the object or array that should be transformed
* @param int $statusCode the Http status code, defaults to 200 * @param int $statusCode the Http status code, defaults to 200
*/ */
@ -55,7 +64,7 @@ class JSONResponse extends Response {
/** /**
* Sets values in the data json array * Sets values in the data json array
* @param array|object $params an array or object which will be transformed * @param array|object $data an array or object which will be transformed
* to JSON * to JSON
*/ */
public function setData($data){ public function setData($data){

View File

@ -20,6 +20,10 @@
* *
*/ */
/**
* Public interface of ownCloud for apps to use.
* AppFramework\HTTP\Response class
*/
namespace OCP\AppFramework\Http; namespace OCP\AppFramework\Http;

View File

@ -20,6 +20,10 @@
* *
*/ */
/**
* Public interface of ownCloud for apps to use.
* AppFramework\HTTP\TemplateResponse class
*/
namespace OCP\AppFramework\Http; namespace OCP\AppFramework\Http;
@ -29,14 +33,34 @@ namespace OCP\AppFramework\Http;
*/ */
class TemplateResponse extends Response { class TemplateResponse extends Response {
/**
* name of the template
* @var string
*/
protected $templateName; protected $templateName;
/**
* parameters
* @var array
*/
protected $params; protected $params;
/**
* rendering type (admin, user, blank)
* @var string
*/
protected $renderAs; protected $renderAs;
/**
* app name
* @var string
*/
protected $appName; protected $appName;
/** /**
* @param string $templateName the name of the template * constructor of TemplateResponse
* @param string $appName the name of the app to load the template from * @param string $appName the name of the app to load the template from
* @param string $templateName the name of the template
*/ */
public function __construct($appName, $templateName) { public function __construct($appName, $templateName) {
$this->templateName = $templateName; $this->templateName = $templateName;

View File

@ -20,6 +20,10 @@
* *
*/ */
/**
* Public interface of ownCloud for apps to use.
* AppFramework\Middleware class
*/
namespace OCP\AppFramework; namespace OCP\AppFramework;

View File

@ -64,7 +64,7 @@ interface IContainer {
* In case the parameter is false the service will be recreated on every call. * In case the parameter is false the service will be recreated on every call.
* *
* @param string $name * @param string $name
* @param callable $closure * @param \Closure $closure
* @param bool $shared * @param bool $shared
* @return void * @return void
*/ */