diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-04-16 17:00:08 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-04-16 17:00:08 +0200 |
commit | 7644950b48b094bfe5675348aefb7cf5747d325b (patch) | |
tree | a1792e21239a86f471da99b454134a5d8533ef77 /lib/public/appframework | |
parent | 8653da6c16597959c7bd0f0b202747ff96204575 (diff) | |
download | nextcloud-server-7644950b48b094bfe5675348aefb7cf5747d325b.tar.gz nextcloud-server-7644950b48b094bfe5675348aefb7cf5747d325b.zip |
Add @since tags to all methods in public namespace
* enhance the app development experience - you can look up the
method introduction right inside the code without searching
via git blame
* easier to write apps for multiple versions
Diffstat (limited to 'lib/public/appframework')
28 files changed, 187 insertions, 13 deletions
diff --git a/lib/public/appframework/apicontroller.php b/lib/public/appframework/apicontroller.php index 0cb5b0c7d5b..0af37f3a616 100644 --- a/lib/public/appframework/apicontroller.php +++ b/lib/public/appframework/apicontroller.php @@ -33,6 +33,7 @@ use OCP\IRequest; /** * Base class to inherit your controllers from that are used for RESTful APIs + * @since 7.0.0 */ abstract class ApiController extends Controller { @@ -52,6 +53,7 @@ abstract class ApiController extends Controller { * defaults to 'Authorization, Content-Type, Accept' * @param int $corsMaxAge number in seconds how long a preflighted OPTIONS * request should be cached, defaults to 1728000 seconds + * @since 7.0.0 */ public function __construct($appName, IRequest $request, @@ -72,6 +74,7 @@ abstract class ApiController extends Controller { * @NoAdminRequired * @NoCSRFRequired * @PublicPage + * @since 7.0.0 */ public function preflightedCors() { if(isset($this->request->server['HTTP_ORIGIN'])) { diff --git a/lib/public/appframework/app.php b/lib/public/appframework/app.php index d070e0d4c83..bf4e14961f5 100644 --- a/lib/public/appframework/app.php +++ b/lib/public/appframework/app.php @@ -38,6 +38,7 @@ use OC\AppFramework\routing\RouteConfig; * * Any application must inherit this call - all controller instances to be used are * to be registered using IContainer::registerService + * @since 6.0.0 */ class App { @@ -50,6 +51,7 @@ class App { * @param string $topNamespace the namespace which should be prepended to * the transformed app id, defaults to OCA\ * @return string the starting namespace for the app + * @since 8.0.0 */ public static function buildAppNamespace($appId, $topNamespace='OCA\\') { return \OC\AppFramework\App::buildAppNamespace($appId, $topNamespace); @@ -58,6 +60,7 @@ class App { /** * @param array $urlParams an array with variables extracted from the routes + * @since 6.0.0 */ public function __construct($appName, $urlParams = array()) { $this->container = new \OC\AppFramework\DependencyInjection\DIContainer($appName, $urlParams); @@ -67,6 +70,7 @@ class App { /** * @return IAppContainer + * @since 6.0.0 */ public function getContainer() { return $this->container; @@ -88,6 +92,7 @@ class App { * * @param \OCP\Route\IRouter $router * @param array $routes + * @since 6.0.0 */ public function registerRoutes($router, $routes) { $routeConfig = new RouteConfig($this->container, $router, $routes); @@ -123,6 +128,7 @@ class App { * @param string $controllerName the name of the controller under which it is * stored in the DI container * @param string $methodName the method that you want to call + * @since 6.0.0 */ public function dispatch($controllerName, $methodName) { \OC\AppFramework\App::main($controllerName, $methodName, $this->container); 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()){ diff --git a/lib/public/appframework/db/doesnotexistexception.php b/lib/public/appframework/db/doesnotexistexception.php index 2d5d145c223..6df0477498c 100644 --- a/lib/public/appframework/db/doesnotexistexception.php +++ b/lib/public/appframework/db/doesnotexistexception.php @@ -27,6 +27,7 @@ namespace OCP\AppFramework\Db; /** * This is returned or should be returned when a find request does not find an * entry in the database + * @since 7.0.0 */ class DoesNotExistException extends \Exception { @@ -38,4 +39,4 @@ class DoesNotExistException extends \Exception { parent::__construct($msg); } -}
\ No newline at end of file +} diff --git a/lib/public/appframework/db/entity.php b/lib/public/appframework/db/entity.php index 1a9e9777fe4..a12f759357e 100644 --- a/lib/public/appframework/db/entity.php +++ b/lib/public/appframework/db/entity.php @@ -26,6 +26,7 @@ namespace OCP\AppFramework\Db; /** * @method integer getId() * @method void setId(integer $id) + * @since 7.0.0 */ abstract class Entity { @@ -40,6 +41,7 @@ abstract class Entity { * @param array $params the array which was obtained via $this->params('key') * in the controller * @return Entity + * @since 7.0.0 */ public static function fromParams(array $params) { $instance = new static(); @@ -56,6 +58,7 @@ abstract class Entity { /** * Maps the keys of the row array to the attributes * @param array $row the row to map onto the entity + * @since 7.0.0 */ public static function fromRow(array $row){ $instance = new static(); @@ -73,7 +76,8 @@ abstract class Entity { /** - * @return an array with attribute and type + * @return array with attribute and type + * @since 7.0.0 */ public function getFieldTypes() { return $this->_fieldTypes; @@ -82,12 +86,12 @@ abstract class Entity { /** * Marks the entity as clean needed for setting the id after the insertion + * @since 7.0.0 */ public function resetUpdatedFields(){ $this->_updatedFields = array(); } - protected function setter($name, $args) { // setters should only work for existing attributes if(property_exists($this, $name)){ @@ -108,7 +112,6 @@ abstract class Entity { } } - protected function getter($name) { // getters should only work for existing attributes if(property_exists($this, $name)){ @@ -125,6 +128,7 @@ abstract class Entity { * into an array: for instance setId will save Id in the * updated fields array so it can be easily used to create the * getter method + * @since 7.0.0 */ public function __call($methodName, $args){ $attr = lcfirst( substr($methodName, 3) ); @@ -154,6 +158,7 @@ abstract class Entity { * Transform a database columnname to a property * @param string $columnName the name of the column * @return string the property name + * @since 7.0.0 */ public function columnToProperty($columnName){ $parts = explode('_', $columnName); @@ -175,6 +180,7 @@ abstract class Entity { * Transform a property to a database column name * @param string $property the name of the property * @return string the column name + * @since 7.0.0 */ public function propertyToColumn($property){ $parts = preg_split('/(?=[A-Z])/', $property); @@ -194,6 +200,7 @@ abstract class Entity { /** * @return array array of updated fields for update query + * @since 7.0.0 */ public function getUpdatedFields(){ return $this->_updatedFields; @@ -216,6 +223,7 @@ abstract class Entity { * Warning: This doesn't result in a unique value * @param string $attributeName the name of the attribute, which value should be slugified * @return string slugified value + * @since 7.0.0 */ public function slugify($attributeName){ // toSlug should only work for existing attributes diff --git a/lib/public/appframework/db/mapper.php b/lib/public/appframework/db/mapper.php index 16a781f0ead..157bea36916 100644 --- a/lib/public/appframework/db/mapper.php +++ b/lib/public/appframework/db/mapper.php @@ -32,6 +32,7 @@ use OCP\IDb; /** * Simple parent class for inheriting your data access layer from. This class * may be subject to change in the future + * @since 7.0.0 */ abstract class Mapper { @@ -44,6 +45,7 @@ abstract class Mapper { * @param string $tableName the name of the table. set this to allow entity * @param string $entityClass the name of the entity that the sql should be * mapped to queries without using sql + * @since 7.0.0 */ public function __construct(IDBConnection $db, $tableName, $entityClass=null){ $this->db = $db; @@ -61,6 +63,7 @@ abstract class Mapper { /** * @return string the table name + * @since 7.0.0 */ public function getTableName(){ return $this->tableName; @@ -71,6 +74,7 @@ abstract class Mapper { * Deletes an entity from the table * @param Entity $entity the entity that should be deleted * @return Entity the deleted entity + * @since 7.0.0 - return value added in 8.1.0 */ public function delete(Entity $entity){ $sql = 'DELETE FROM `' . $this->tableName . '` WHERE `id` = ?'; @@ -84,6 +88,7 @@ abstract class Mapper { * Creates a new entry in the db from an entity * @param Entity $entity the entity that should be created * @return Entity the saved entity with the set id + * @since 7.0.0 */ public function insert(Entity $entity){ // get updated fields to save, fields have to be set using a setter to @@ -132,6 +137,7 @@ abstract class Mapper { * @throws \InvalidArgumentException if entity has no id * @param Entity $entity the entity that should be created * @return Entity the saved entity with the set id + * @since 7.0.0 - return value was added in 8.0.0 */ public function update(Entity $entity){ // if entity wasn't changed it makes no sense to run a db query @@ -216,6 +222,7 @@ abstract class Mapper { * @param int $limit the maximum number of rows * @param int $offset from which row we want to start * @return \PDOStatement the database query result + * @since 7.0.0 */ protected function execute($sql, array $params=[], $limit=null, $offset=null){ if ($this->db instanceof IDb) { @@ -264,6 +271,7 @@ abstract class Mapper { * @throws DoesNotExistException if the item does not exist * @throws MultipleObjectsReturnedException if more than one item exist * @return array the result as row + * @since 7.0.0 */ protected function findOneQuery($sql, array $params=[], $limit=null, $offset=null){ $stmt = $this->execute($sql, $params, $limit, $offset); @@ -289,6 +297,7 @@ abstract class Mapper { * from the current mapper name (MyEntityMapper -> MyEntity) * @param array $row the row which should be converted to an entity * @return Entity the entity + * @since 7.0.0 */ protected function mapRowToEntity($row) { return call_user_func($this->entityClass .'::fromRow', $row); @@ -302,6 +311,7 @@ abstract class Mapper { * @param int $limit the maximum number of rows * @param int $offset from which row we want to start * @return array all fetched entities + * @since 7.0.0 */ protected function findEntities($sql, array $params=[], $limit=null, $offset=null) { $stmt = $this->execute($sql, $params, $limit, $offset); @@ -328,6 +338,7 @@ abstract class Mapper { * @throws DoesNotExistException if the item does not exist * @throws MultipleObjectsReturnedException if more than one item exist * @return Entity the entity + * @since 7.0.0 */ protected function findEntity($sql, array $params=[], $limit=null, $offset=null){ return $this->mapRowToEntity($this->findOneQuery($sql, $params, $limit, $offset)); diff --git a/lib/public/appframework/db/multipleobjectsreturnedexception.php b/lib/public/appframework/db/multipleobjectsreturnedexception.php index 6aa4ea349dc..cdfb748b145 100644 --- a/lib/public/appframework/db/multipleobjectsreturnedexception.php +++ b/lib/public/appframework/db/multipleobjectsreturnedexception.php @@ -27,6 +27,7 @@ namespace OCP\AppFramework\Db; /** * This is returned or should be returned when a find request finds more than one * row + * @since 7.0.0 */ class MultipleObjectsReturnedException extends \Exception { @@ -38,4 +39,4 @@ class MultipleObjectsReturnedException extends \Exception { parent::__construct($msg); } -}
\ No newline at end of file +} diff --git a/lib/public/appframework/http.php b/lib/public/appframework/http.php index 095b8e30583..65b62ffd15a 100644 --- a/lib/public/appframework/http.php +++ b/lib/public/appframework/http.php @@ -30,6 +30,7 @@ namespace OCP\AppFramework; /** * Base class which contains constants for HTTP status codes + * @since 6.0.0 */ class Http { diff --git a/lib/public/appframework/http/contentsecuritypolicy.php b/lib/public/appframework/http/contentsecuritypolicy.php index 6c527879698..be4b6e60f97 100644 --- a/lib/public/appframework/http/contentsecuritypolicy.php +++ b/lib/public/appframework/http/contentsecuritypolicy.php @@ -35,6 +35,7 @@ use OCP\AppFramework\Http; * should require no modification at all for most use-cases. * * @package OCP\AppFramework\Http + * @since 8.1.0 */ class ContentSecurityPolicy { /** @var bool Whether inline JS snippets are allowed */ @@ -86,6 +87,7 @@ class ContentSecurityPolicy { * Whether inline JavaScript snippets are allowed or forbidden * @param bool $state * @return $this + * @since 8.1.0 */ public function allowInlineScript($state = false) { $this->inlineScriptAllowed = $state; @@ -96,6 +98,7 @@ class ContentSecurityPolicy { * Whether eval in JavaScript is allowed or forbidden * @param bool $state * @return $this + * @since 8.1.0 */ public function allowEvalScript($state = true) { $this->evalScriptAllowed= $state; @@ -107,6 +110,7 @@ class ContentSecurityPolicy { * allow JavaScript from all domains. * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. * @return $this + * @since 8.1.0 */ public function addAllowedScriptDomain($domain) { $this->allowedScriptDomains[] = $domain; @@ -117,6 +121,7 @@ class ContentSecurityPolicy { * Whether inline CSS snippets are allowed or forbidden * @param bool $state * @return $this + * @since 8.1.0 */ public function allowInlineStyle($state = true) { $this->inlineStyleAllowed = $state; @@ -128,6 +133,7 @@ class ContentSecurityPolicy { * CSS from all domains. * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. * @return $this + * @since 8.1.0 */ public function addAllowedStyleDomain($domain) { $this->allowedStyleDomains[] = $domain; @@ -139,6 +145,7 @@ class ContentSecurityPolicy { * fonts from all domains. * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. * @return $this + * @since 8.1.0 */ public function addAllowedFontDomain($domain) { $this->allowedFontDomains[] = $domain; @@ -150,6 +157,7 @@ class ContentSecurityPolicy { * images from all domains. * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. * @return $this + * @since 8.1.0 */ public function addAllowedImageDomain($domain) { $this->allowedImageDomains[] = $domain; @@ -160,6 +168,7 @@ class ContentSecurityPolicy { * To which remote domains the JS connect to. * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. * @return $this + * @since 8.1.0 */ public function addAllowedConnectDomain($domain) { $this->allowedConnectDomains[] = $domain; @@ -170,6 +179,7 @@ class ContentSecurityPolicy { * From whoch domains media elements can be embedded. * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. * @return $this + * @since 8.1.0 */ public function addAllowedMediaDomain($domain) { $this->allowedMediaDomains[] = $domain; @@ -180,6 +190,7 @@ class ContentSecurityPolicy { * From which domains objects such as <object>, <embed> or <applet> are executed * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. * @return $this + * @since 8.1.0 */ public function addAllowedObjectDomain($domain) { $this->allowedObjectDomains[] = $domain; @@ -190,6 +201,7 @@ class ContentSecurityPolicy { * Which domains can be embedded in an iframe * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. * @return $this + * @since 8.1.0 */ public function addAllowedFrameDomain($domain) { $this->allowedFrameDomains[] = $domain; @@ -200,6 +212,7 @@ class ContentSecurityPolicy { * Domains from which web-workers and nested browsing content can load elements * @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized. * @return $this + * @since 8.1.0 */ public function addAllowedChildSrcDomain($domain) { $this->allowedChildSrcDomains[] = $domain; @@ -209,6 +222,7 @@ class ContentSecurityPolicy { /** * Get the generated Content-Security-Policy as a string * @return string + * @since 8.1.0 */ public function buildPolicy() { $policy = "default-src 'none';"; diff --git a/lib/public/appframework/http/datadisplayresponse.php b/lib/public/appframework/http/datadisplayresponse.php index ebb77950c96..35272d0f823 100644 --- a/lib/public/appframework/http/datadisplayresponse.php +++ b/lib/public/appframework/http/datadisplayresponse.php @@ -23,6 +23,12 @@ namespace OCP\AppFramework\Http; use OCP\AppFramework\Http; +/** + * Class DataDisplayResponse + * + * @package OCP\AppFramework\Http + * @since 8.1.0 + */ class DataDisplayResponse extends Response { /** @@ -36,6 +42,7 @@ class DataDisplayResponse extends Response { * @param string $data the data to display * @param int $statusCode the Http status code, defaults to 200 * @param array $headers additional key value based headers + * @since 8.1.0 */ public function __construct($data="", $statusCode=Http::STATUS_OK, $headers=[]) { @@ -48,6 +55,7 @@ class DataDisplayResponse extends Response { /** * Outputs data. No processing is done. * @return string + * @since 8.1.0 */ public function render() { return $this->data; @@ -58,6 +66,7 @@ class DataDisplayResponse extends Response { * Sets values in the data * @param string $data the data to display * @return DataDisplayResponse Reference to this object + * @since 8.1.0 */ public function setData($data){ $this->data = $data; @@ -69,6 +78,7 @@ class DataDisplayResponse extends Response { /** * Used to get the set parameters * @return string the data + * @since 8.1.0 */ public function getData(){ return $this->data; diff --git a/lib/public/appframework/http/datadownloadresponse.php b/lib/public/appframework/http/datadownloadresponse.php index 837023acb8a..612386f9801 100644 --- a/lib/public/appframework/http/datadownloadresponse.php +++ b/lib/public/appframework/http/datadownloadresponse.php @@ -21,6 +21,12 @@ */ namespace OCP\AppFramework\Http; +/** + * Class DataDownloadResponse + * + * @package OCP\AppFramework\Http + * @since 8.0.0 + */ class DataDownloadResponse extends DownloadResponse { /** * @var string @@ -32,6 +38,7 @@ class DataDownloadResponse extends DownloadResponse { * @param string $data text to be downloaded * @param string $filename the name that the downloaded file should have * @param string $contentType the mimetype that the downloaded file should have + * @since 8.0.0 */ public function __construct($data, $filename, $contentType) { $this->data = $data; @@ -40,6 +47,7 @@ class DataDownloadResponse extends DownloadResponse { /** * @param string $data + * @since 8.0.0 */ public function setData($data) { $this->data = $data; @@ -47,6 +55,7 @@ class DataDownloadResponse extends DownloadResponse { /** * @return string + * @since 8.0.0 */ public function render() { return $this->data; diff --git a/lib/public/appframework/http/dataresponse.php b/lib/public/appframework/http/dataresponse.php index b86686ffe82..555faa6ea1a 100644 --- a/lib/public/appframework/http/dataresponse.php +++ b/lib/public/appframework/http/dataresponse.php @@ -32,6 +32,7 @@ use OCP\AppFramework\Http; /** * A generic DataResponse class that is used to return generic data responses * for responders to transform + * @since 8.0.0 */ class DataResponse extends Response { @@ -46,6 +47,7 @@ class DataResponse extends Response { * @param array|object $data the object or array that should be transformed * @param int $statusCode the Http status code, defaults to 200 * @param array $headers additional key value based headers + * @since 8.0.0 */ public function __construct($data=array(), $statusCode=Http::STATUS_OK, array $headers=array()) { @@ -59,6 +61,7 @@ class DataResponse extends Response { * Sets values in the data json array * @param array|object $data an array or object which will be transformed * @return DataResponse Reference to this object + * @since 8.0.0 */ public function setData($data){ $this->data = $data; @@ -70,6 +73,7 @@ class DataResponse extends Response { /** * Used to get the set parameters * @return array the data + * @since 8.0.0 */ public function getData(){ return $this->data; diff --git a/lib/public/appframework/http/downloadresponse.php b/lib/public/appframework/http/downloadresponse.php index dfcc65ffea5..0b9a8bcc6d8 100644 --- a/lib/public/appframework/http/downloadresponse.php +++ b/lib/public/appframework/http/downloadresponse.php @@ -27,6 +27,7 @@ namespace OCP\AppFramework\Http; /** * Prompts the user to download the a file + * @since 7.0.0 */ class DownloadResponse extends \OCP\AppFramework\Http\Response { @@ -37,6 +38,7 @@ class DownloadResponse extends \OCP\AppFramework\Http\Response { * Creates a response that prompts the user to download the file * @param string $filename the name that the downloaded file should have * @param string $contentType the mimetype that the downloaded file should have + * @since 7.0.0 */ public function __construct($filename, $contentType) { $this->filename = $filename; diff --git a/lib/public/appframework/http/icallbackresponse.php b/lib/public/appframework/http/icallbackresponse.php index 2f27a164897..87da73a5ad5 100644 --- a/lib/public/appframework/http/icallbackresponse.php +++ b/lib/public/appframework/http/icallbackresponse.php @@ -27,6 +27,7 @@ namespace OCP\AppFramework\Http; * Interface ICallbackResponse * * @package OCP\AppFramework\Http + * @since 8.1.0 */ interface ICallbackResponse { @@ -34,6 +35,7 @@ interface ICallbackResponse { * Outputs the content that should be printed * * @param IOutput $output a small wrapper that handles output + * @since 8.1.0 */ function callback(IOutput $output); diff --git a/lib/public/appframework/http/ioutput.php b/lib/public/appframework/http/ioutput.php index 8fd362daf16..ad90dc1e4cb 100644 --- a/lib/public/appframework/http/ioutput.php +++ b/lib/public/appframework/http/ioutput.php @@ -24,11 +24,13 @@ namespace OCP\AppFramework\Http; /** * Very thin wrapper class to make output testable + * @since 8.1.0 */ interface IOutput { /** * @param string $out + * @since 8.1.0 */ public function setOutput($out); @@ -36,21 +38,25 @@ interface IOutput { * @param string $path * * @return bool false if an error occured + * @since 8.1.0 */ public function setReadfile($path); /** * @param string $header + * @since 8.1.0 */ public function setHeader($header); /** * @return int returns the current http response code + * @since 8.1.0 */ public function getHttpResponseCode(); /** * @param int $code sets the http status code + * @since 8.1.0 */ public function setHttpResponseCode($code); @@ -62,6 +68,7 @@ interface IOutput { * @param string $domain * @param bool $secure * @param bool $httponly + * @since 8.1.0 */ public function setCookie($name, $value, $expire, $path, $domain, $secure, $httponly); diff --git a/lib/public/appframework/http/jsonresponse.php b/lib/public/appframework/http/jsonresponse.php index 492811043f1..1a770109d45 100644 --- a/lib/public/appframework/http/jsonresponse.php +++ b/lib/public/appframework/http/jsonresponse.php @@ -33,6 +33,7 @@ use OCP\AppFramework\Http; /** * A renderer for JSON calls + * @since 6.0.0 */ class JSONResponse extends Response { @@ -47,6 +48,7 @@ class JSONResponse extends Response { * constructor of JSONResponse * @param array|object $data the object or array that should be transformed * @param int $statusCode the Http status code, defaults to 200 + * @since 6.0.0 */ public function __construct($data=array(), $statusCode=Http::STATUS_OK) { $this->data = $data; @@ -58,6 +60,7 @@ class JSONResponse extends Response { /** * Returns the rendered json * @return string the rendered json + * @since 6.0.0 */ public function render(){ return json_encode($this->data); @@ -68,6 +71,7 @@ class JSONResponse extends Response { * @param array|object $data an array or object which will be transformed * to JSON * @return JSONResponse Reference to this object + * @since 6.0.0 - return value was added in 7.0.0 */ public function setData($data){ $this->data = $data; @@ -79,6 +83,7 @@ class JSONResponse extends Response { /** * Used to get the set parameters * @return array the data + * @since 6.0.0 */ public function getData(){ return $this->data; diff --git a/lib/public/appframework/http/notfoundresponse.php b/lib/public/appframework/http/notfoundresponse.php index 21f0461f5e6..8f59384faf1 100644 --- a/lib/public/appframework/http/notfoundresponse.php +++ b/lib/public/appframework/http/notfoundresponse.php @@ -26,15 +26,20 @@ use OCP\Template; /** * A generic 404 response showing an 404 error page as well to the end-user + * @since 8.1.0 */ class NotFoundResponse extends Response { + /** + * @since 8.1.0 + */ public function __construct() { $this->setStatus(404); } /** * @return string + * @since 8.1.0 */ public function render() { $template = new Template('core', '404', 'guest'); diff --git a/lib/public/appframework/http/ocsresponse.php b/lib/public/appframework/http/ocsresponse.php index 4cc1ba80d03..c098e306656 100644 --- a/lib/public/appframework/http/ocsresponse.php +++ b/lib/public/appframework/http/ocsresponse.php @@ -33,6 +33,7 @@ use OC_OCS; /** * A renderer for OCS responses + * @since 8.1.0 */ class OCSResponse extends Response { @@ -58,6 +59,7 @@ class OCSResponse extends Response { * @param int $dimension * @param int|string $itemscount * @param int|string $itemsperpage + * @since 8.1.0 */ public function __construct($format, $status, $statuscode, $message, $data=[], $tag='', $tagattribute='', @@ -86,7 +88,10 @@ class OCSResponse extends Response { } } - + /** + * @return string + * @since 8.1.0 + */ public function render() { return OC_OCS::generateXml( $this->format, $this->status, $this->statuscode, $this->message, @@ -96,4 +101,4 @@ class OCSResponse extends Response { } -}
\ No newline at end of file +} diff --git a/lib/public/appframework/http/redirectresponse.php b/lib/public/appframework/http/redirectresponse.php index a9108be8c04..41a2e48035e 100644 --- a/lib/public/appframework/http/redirectresponse.php +++ b/lib/public/appframework/http/redirectresponse.php @@ -31,6 +31,7 @@ use OCP\AppFramework\Http; /** * Redirects to a different URL + * @since 7.0.0 */ class RedirectResponse extends Response { @@ -39,6 +40,7 @@ class RedirectResponse extends Response { /** * Creates a response that redirects to a url * @param string $redirectURL the url to redirect to + * @since 7.0.0 */ public function __construct($redirectURL) { $this->redirectURL = $redirectURL; @@ -49,6 +51,7 @@ class RedirectResponse extends Response { /** * @return string the url to redirect + * @since 7.0.0 */ public function getRedirectURL() { return $this->redirectURL; diff --git a/lib/public/appframework/http/response.php b/lib/public/appframework/http/response.php index b79777c5f1d..8fd5fdd8f53 100644 --- a/lib/public/appframework/http/response.php +++ b/lib/public/appframework/http/response.php @@ -37,6 +37,7 @@ use OCP\AppFramework\Http; * Base class for responses. Also used to just send headers. * * It handles headers, HTTP status code, last modified and ETag. + * @since 6.0.0 */ class Response { @@ -85,6 +86,7 @@ class Response { * @param int $cacheSeconds the amount of seconds that should be cached * if 0 then caching will be disabled * @return $this + * @since 6.0.0 - return value was added in 7.0.0 */ public function cacheFor($cacheSeconds) { @@ -106,6 +108,7 @@ class Response { * to null cookie will be considered as session * cookie. * @return $this + * @since 8.0.0 */ public function addCookie($name, $value, \DateTime $expireDate = null) { $this->cookies[$name] = array('value' => $value, 'expireDate' => $expireDate); @@ -117,6 +120,7 @@ class Response { * Set the specified cookies * @param array $cookies array('foo' => array('value' => 'bar', 'expire' => null)) * @return $this + * @since 8.0.0 */ public function setCookies(array $cookies) { $this->cookies = $cookies; @@ -128,6 +132,7 @@ class Response { * Invalidates the specified cookie * @param string $name * @return $this + * @since 8.0.0 */ public function invalidateCookie($name) { $this->addCookie($name, 'expired', new \DateTime('1971-01-01 00:00')); @@ -138,6 +143,7 @@ class Response { * Invalidates the specified cookies * @param array $cookieNames array('foo', 'bar') * @return $this + * @since 8.0.0 */ public function invalidateCookies(array $cookieNames) { foreach($cookieNames as $cookieName) { @@ -149,6 +155,7 @@ class Response { /** * Returns the cookies * @return array + * @since 8.0.0 */ public function getCookies() { return $this->cookies; @@ -160,6 +167,7 @@ class Response { * @param string $name The name of the HTTP header * @param string $value The value, null will delete it * @return $this + * @since 6.0.0 - return value was added in 7.0.0 */ public function addHeader($name, $value) { $name = trim($name); // always remove leading and trailing whitespace @@ -180,6 +188,7 @@ class Response { * Set the headers * @param array $headers value header pairs * @return $this + * @since 8.0.0 */ public function setHeaders(array $headers) { $this->headers = $headers; @@ -191,6 +200,7 @@ class Response { /** * Returns the set headers * @return array the headers + * @since 6.0.0 */ public function getHeaders() { $mergeWith = []; @@ -217,6 +227,7 @@ class Response { /** * By default renders no output * @return null + * @since 6.0.0 */ public function render() { return null; @@ -224,10 +235,11 @@ class Response { /** - * Set response status - * @param int $status a HTTP status code, see also the STATUS constants - * @return Response Reference to this object - */ + * Set response status + * @param int $status a HTTP status code, see also the STATUS constants + * @return Response Reference to this object + * @since 6.0.0 - return value was added in 7.0.0 + */ public function setStatus($status) { $this->status = $status; @@ -238,6 +250,7 @@ class Response { * Set a Content-Security-Policy * @param ContentSecurityPolicy $csp Policy to set for the response object * @return $this + * @since 8.1.0 */ public function setContentSecurityPolicy(ContentSecurityPolicy $csp) { $this->contentSecurityPolicy = $csp; @@ -248,6 +261,7 @@ class Response { * Get the currently used Content-Security-Policy * @return ContentSecurityPolicy|null Used Content-Security-Policy or null if * none specified. + * @since 8.1.0 */ public function getContentSecurityPolicy() { return $this->contentSecurityPolicy; @@ -256,6 +270,7 @@ class Response { /** * Get response status + * @since 6.0.0 */ public function getStatus() { return $this->status; @@ -265,6 +280,7 @@ class Response { /** * Get the ETag * @return string the etag + * @since 6.0.0 */ public function getETag() { return $this->ETag; @@ -274,6 +290,7 @@ class Response { /** * Get "last modified" date * @return \DateTime RFC2822 formatted last modified date + * @since 6.0.0 */ public function getLastModified() { return $this->lastModified; @@ -284,6 +301,7 @@ class Response { * Set the ETag * @param string $ETag * @return Response Reference to this object + * @since 6.0.0 - return value was added in 7.0.0 */ public function setETag($ETag) { $this->ETag = $ETag; @@ -296,6 +314,7 @@ class Response { * Set "last modified" date * @param \DateTime $lastModified * @return Response Reference to this object + * @since 6.0.0 - return value was added in 7.0.0 */ public function setLastModified($lastModified) { $this->lastModified = $lastModified; diff --git a/lib/public/appframework/http/streamresponse.php b/lib/public/appframework/http/streamresponse.php index 057c395d84f..625b3d62278 100644 --- a/lib/public/appframework/http/streamresponse.php +++ b/lib/public/appframework/http/streamresponse.php @@ -28,6 +28,7 @@ use OCP\AppFramework\Http; * Class StreamResponse * * @package OCP\AppFramework\Http + * @since 8.1.0 */ class StreamResponse extends Response implements ICallbackResponse { /** @var string */ @@ -35,6 +36,7 @@ class StreamResponse extends Response implements ICallbackResponse { /** * @param string $filePath the path to the file which should be streamed + * @since 8.1.0 */ public function __construct ($filePath) { $this->filePath = $filePath; @@ -45,6 +47,7 @@ class StreamResponse extends Response implements ICallbackResponse { * Streams the file using readfile * * @param IOutput $output a small wrapper that handles output + * @since 8.1.0 */ public function callback (IOutput $output) { // handle caching diff --git a/lib/public/appframework/http/templateresponse.php b/lib/public/appframework/http/templateresponse.php index 209b069c89a..961903a8eab 100644 --- a/lib/public/appframework/http/templateresponse.php +++ b/lib/public/appframework/http/templateresponse.php @@ -32,6 +32,7 @@ namespace OCP\AppFramework\Http; /** * Response for a normal template + * @since 6.0.0 */ class TemplateResponse extends Response { @@ -66,6 +67,7 @@ class TemplateResponse extends Response { * @param array $params an array of parameters which should be passed to the * template * @param string $renderAs how the page should be rendered, defaults to user + * @since 6.0.0 - parameters $params and $renderAs were added in 7.0.0 */ public function __construct($appName, $templateName, array $params=array(), $renderAs='user') { @@ -81,6 +83,7 @@ class TemplateResponse extends Response { * @param array $params an array with key => value structure which sets template * variables * @return TemplateResponse Reference to this object + * @since 6.0.0 - return value was added in 7.0.0 */ public function setParams(array $params){ $this->params = $params; @@ -92,6 +95,7 @@ class TemplateResponse extends Response { /** * Used for accessing the set parameters * @return array the params + * @since 6.0.0 */ public function getParams(){ return $this->params; @@ -101,6 +105,7 @@ class TemplateResponse extends Response { /** * Used for accessing the name of the set template * @return string the name of the used template + * @since 6.0.0 */ public function getTemplateName(){ return $this->templateName; @@ -114,6 +119,7 @@ class TemplateResponse extends Response { * normal page including footer and header and blank * just renders the plain template * @return TemplateResponse Reference to this object + * @since 6.0.0 - return value was added in 7.0.0 */ public function renderAs($renderAs){ $this->renderAs = $renderAs; @@ -125,6 +131,7 @@ class TemplateResponse extends Response { /** * Returns the set renderAs * @return string the renderAs value + * @since 6.0.0 */ public function getRenderAs(){ return $this->renderAs; @@ -134,6 +141,7 @@ class TemplateResponse extends Response { /** * Returns the rendered html * @return string the rendered html + * @since 6.0.0 */ public function render(){ // \OCP\Template needs an empty string instead of 'blank' for an unwrapped response diff --git a/lib/public/appframework/iappcontainer.php b/lib/public/appframework/iappcontainer.php index a577d31ed93..47eba58aece 100644 --- a/lib/public/appframework/iappcontainer.php +++ b/lib/public/appframework/iappcontainer.php @@ -32,35 +32,41 @@ use OCP\IContainer; * @package OCP\AppFramework * * This container interface provides short cuts for app developers to access predefined app service. + * @since 6.0.0 */ interface IAppContainer extends IContainer { /** * used to return the appname of the set application * @return string the name of your application + * @since 6.0.0 */ function getAppName(); /** * @deprecated implements only deprecated methods * @return IApi + * @since 6.0.0 */ function getCoreApi(); /** * @return \OCP\IServerContainer + * @since 6.0.0 */ function getServer(); /** * @param string $middleWare * @return boolean + * @since 6.0.0 */ function registerMiddleWare($middleWare); /** * @deprecated use IUserSession->isLoggedIn() * @return boolean + * @since 6.0.0 */ function isLoggedIn(); @@ -69,6 +75,7 @@ interface IAppContainer extends IContainer { * @return boolean * @deprecated use the groupmanager instead to find out if the user is in * the admin group + * @since 6.0.0 */ function isAdminUser(); @@ -77,6 +84,7 @@ interface IAppContainer extends IContainer { * @param string $message * @param string $level * @return mixed + * @since 6.0.0 */ function log($message, $level); diff --git a/lib/public/appframework/middleware.php b/lib/public/appframework/middleware.php index c7c46347623..6c75a2dfc74 100644 --- a/lib/public/appframework/middleware.php +++ b/lib/public/appframework/middleware.php @@ -37,6 +37,7 @@ use OCP\AppFramework\Http\Response; * deal with possible exceptions raised in the controller methods. * They're modeled after Django's middleware system: * https://docs.djangoproject.com/en/dev/topics/http/middleware/ + * @since 6.0.0 */ abstract class Middleware { @@ -48,6 +49,7 @@ abstract class Middleware { * @param Controller $controller the controller that is being called * @param string $methodName the name of the method that will be called on * the controller + * @since 6.0.0 */ public function beforeController($controller, $methodName){ @@ -67,6 +69,7 @@ abstract class Middleware { * @param \Exception $exception the thrown exception * @throws \Exception the passed in exception if it cant handle it * @return Response a Response object in case that the exception was handled + * @since 6.0.0 */ public function afterException($controller, $methodName, \Exception $exception){ throw $exception; @@ -82,6 +85,7 @@ abstract class Middleware { * the controller * @param Response $response the generated response from the controller * @return Response a Response object + * @since 6.0.0 */ public function afterController($controller, $methodName, Response $response){ return $response; @@ -97,6 +101,7 @@ abstract class Middleware { * the controller * @param string $output the generated output from a response * @return string the output that should be printed + * @since 6.0.0 */ public function beforeOutput($controller, $methodName, $output){ return $output; diff --git a/lib/public/appframework/ocscontroller.php b/lib/public/appframework/ocscontroller.php index e3fca47e487..93077586f43 100644 --- a/lib/public/appframework/ocscontroller.php +++ b/lib/public/appframework/ocscontroller.php @@ -34,6 +34,7 @@ use OCP\IRequest; /** * Base class to inherit your controllers from that are used for RESTful APIs + * @since 8.1.0 */ abstract class OCSController extends ApiController { @@ -49,6 +50,7 @@ abstract class OCSController extends ApiController { * defaults to 'Authorization, Content-Type, Accept' * @param int $corsMaxAge number in seconds how long a preflighted OPTIONS * request should be cached, defaults to 1728000 seconds + * @since 8.1.0 */ public function __construct($appName, IRequest $request, @@ -70,6 +72,7 @@ abstract class OCSController extends ApiController { * Unwrap data and build ocs response * @param string $format json or xml * @param array|DataResponse $data the data which should be transformed + * @since 8.1.0 */ private function buildOCSResponse($format, $data) { if ($data instanceof DataResponse) { diff --git a/lib/public/appframework/queryexception.php b/lib/public/appframework/queryexception.php index bf038e19976..c8cd0cfe9fb 100644 --- a/lib/public/appframework/queryexception.php +++ b/lib/public/appframework/queryexception.php @@ -24,5 +24,10 @@ namespace OCP\AppFramework; use Exception; - +/** + * Class QueryException + * + * @package OCP\AppFramework + * @since 8.1.0 + */ class QueryException extends Exception {} diff --git a/lib/public/appframework/utility/icontrollermethodreflector.php b/lib/public/appframework/utility/icontrollermethodreflector.php index 39cf99515c0..a3b57cf6936 100644 --- a/lib/public/appframework/utility/icontrollermethodreflector.php +++ b/lib/public/appframework/utility/icontrollermethodreflector.php @@ -28,12 +28,14 @@ namespace OCP\AppFramework\Utility; * Reads and parses annotations from doc comments * * @package OCP\AppFramework\Utility + * @since 8.0.0 */ interface IControllerMethodReflector { /** * @param object $object an object or classname * @param string $method the method which we want to inspect + * @since 8.0.0 */ public function reflect($object, $method); @@ -44,11 +46,13 @@ interface IControllerMethodReflector { * parsed * @return string|null type in the type parameters (@param int $something) * would return int or null if not existing + * @since 8.0.0 */ public function getType($parameter); /** * @return array the arguments of the method with key => default value + * @since 8.0.0 */ public function getParameters(); @@ -57,7 +61,8 @@ interface IControllerMethodReflector { * * @param string $name the name of the annotation * @return bool true if the annotation is found + * @since 8.0.0 */ public function hasAnnotation($name); -}
\ No newline at end of file +} diff --git a/lib/public/appframework/utility/itimefactory.php b/lib/public/appframework/utility/itimefactory.php index 54013adfbf4..6fe2fab2557 100644 --- a/lib/public/appframework/utility/itimefactory.php +++ b/lib/public/appframework/utility/itimefactory.php @@ -26,11 +26,13 @@ namespace OCP\AppFramework\Utility; /** * Needed to mock calls to time() + * @since 8.0.0 */ interface ITimeFactory { /** * @return int the result of a call to time() + * @since 8.0.0 */ public function getTime(); |