diff options
Diffstat (limited to 'lib/public/appframework/controller.php')
-rw-r--r-- | lib/public/appframework/controller.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/public/appframework/controller.php b/lib/public/appframework/controller.php index 944fe0383e1..7eff52649ce 100644 --- a/lib/public/appframework/controller.php +++ b/lib/public/appframework/controller.php @@ -34,32 +34,41 @@ namespace OCP\AppFramework; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\Http\Response; use OCP\IRequest; /** * Base class to inherit your controllers from + * @since 6.0.0 */ abstract class Controller { /** * app name * @var string + * @since 7.0.0 */ protected $appName; /** * current request * @var \OCP\IRequest + * @since 6.0.0 */ protected $request; + /** + * @var array + * @since 7.0.0 + */ private $responders; /** * constructor of the controller * @param string $appName the name of the app * @param IRequest $request an instance of the request + * @since 6.0.0 - parameter $appName was added in 7.0.0 - parameter $app was removed in 7.0.0 */ public function __construct($appName, IRequest $request){ @@ -88,6 +97,7 @@ abstract class Controller { * Parses an HTTP accept header and returns the supported responder type * @param string $acceptHeader * @return string the responder type + * @since 7.0.0 */ public function getResponderByHTTPHeader($acceptHeader) { $headers = explode(',', $acceptHeader); @@ -112,6 +122,7 @@ abstract class Controller { * Registers a formatter for a type * @param string $format * @param \Closure $responder + * @since 7.0.0 */ protected function registerResponder($format, \Closure $responder) { $this->responders[$format] = $responder; @@ -125,6 +136,7 @@ abstract class Controller { * @param string $format the format for which a formatter has been registered * @throws \DomainException if format does not match a registered formatter * @return Response + * @since 7.0.0 */ public function buildResponse($response, $format='json') { if(array_key_exists($format, $this->responders)) { @@ -151,6 +163,7 @@ abstract class Controller { * 3. GET parameters * @param string $default If the key is not found, this value will be returned * @return mixed the content of the array + * @since 6.0.0 */ public function params($key, $default=null){ return $this->request->getParam($key, $default); @@ -162,6 +175,7 @@ abstract class Controller { * (as GET or POST) or through the URL by the route * @deprecated use $this->request instead * @return array the array with all parameters + * @since 6.0.0 */ public function getParams() { return $this->request->getParams(); @@ -172,6 +186,7 @@ abstract class Controller { * Returns the method of the request * @deprecated use $this->request instead * @return string the method of the request (POST, GET, etc) + * @since 6.0.0 */ public function method() { return $this->request->getMethod(); @@ -183,6 +198,7 @@ abstract class Controller { * @deprecated use $this->request instead * @param string $key the key that will be taken from the $_FILES array * @return array the file in the $_FILES element + * @since 6.0.0 */ public function getUploadedFile($key) { return $this->request->getUploadedFile($key); @@ -194,6 +210,7 @@ abstract class Controller { * @deprecated use $this->request instead * @param string $key the key that will be taken from the $_ENV array * @return array the value in the $_ENV element + * @since 6.0.0 */ public function env($key) { return $this->request->getEnv($key); @@ -205,6 +222,7 @@ abstract class Controller { * @deprecated use $this->request instead * @param string $key the key that will be taken from the $_COOKIE array * @return array the value in the $_COOKIE element + * @since 6.0.0 */ public function cookie($key) { return $this->request->getCookie($key); @@ -220,6 +238,7 @@ abstract class Controller { * admin an entry in the admin settings * @param string[] $headers set additional headers in name/value pairs * @return \OCP\AppFramework\Http\TemplateResponse containing the page + * @since 6.0.0 */ public function render($templateName, array $params=array(), $renderAs='user', array $headers=array()){ |