diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /lib/public/AppFramework | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) | |
download | nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip |
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.
This also removes and empty lines from method/function bodies at the
beginning and end.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/public/AppFramework')
35 files changed, 67 insertions, 113 deletions
diff --git a/lib/public/AppFramework/ApiController.php b/lib/public/AppFramework/ApiController.php index feae56fc2c0..e9fccd1990e 100644 --- a/lib/public/AppFramework/ApiController.php +++ b/lib/public/AppFramework/ApiController.php @@ -38,7 +38,6 @@ use OCP\IRequest; * @since 7.0.0 */ abstract class ApiController extends Controller { - private $corsMethods; private $corsAllowedHeaders; private $corsMaxAge; @@ -79,7 +78,7 @@ abstract class ApiController extends Controller { * @since 7.0.0 */ public function preflightedCors() { - if(isset($this->request->server['HTTP_ORIGIN'])) { + if (isset($this->request->server['HTTP_ORIGIN'])) { $origin = $this->request->server['HTTP_ORIGIN']; } else { $origin = '*'; @@ -93,6 +92,4 @@ abstract class ApiController extends Controller { $response->addHeader('Access-Control-Allow-Credentials', 'false'); return $response; } - - } diff --git a/lib/public/AppFramework/Controller.php b/lib/public/AppFramework/Controller.php index 487b6a854fe..5f6eca8b2f0 100644 --- a/lib/public/AppFramework/Controller.php +++ b/lib/public/AppFramework/Controller.php @@ -148,12 +148,10 @@ abstract class Controller { * @since 7.0.0 */ public function buildResponse($response, $format='json') { - if(array_key_exists($format, $this->responders)) { - + if (array_key_exists($format, $this->responders)) { $responder = $this->responders[$format]; return $responder($response); - } throw new \DomainException('No responder registered for format '. $format . '!'); diff --git a/lib/public/AppFramework/Db/DoesNotExistException.php b/lib/public/AppFramework/Db/DoesNotExistException.php index 36cab24db76..3605bdce274 100644 --- a/lib/public/AppFramework/Db/DoesNotExistException.php +++ b/lib/public/AppFramework/Db/DoesNotExistException.php @@ -42,5 +42,4 @@ class DoesNotExistException extends \Exception implements IMapperException { public function __construct($msg) { parent::__construct($msg); } - } diff --git a/lib/public/AppFramework/Db/Entity.php b/lib/public/AppFramework/Db/Entity.php index 6221f96b375..954b8787c4c 100644 --- a/lib/public/AppFramework/Db/Entity.php +++ b/lib/public/AppFramework/Db/Entity.php @@ -34,7 +34,6 @@ use function substr; * @since 7.0.0 */ abstract class Entity { - public $id; private $_updatedFields = []; @@ -51,7 +50,7 @@ abstract class Entity { public static function fromParams(array $params) { $instance = new static(); - foreach($params as $key => $value) { + foreach ($params as $key => $value) { $method = 'set' . ucfirst($key); $instance->$method($value); } @@ -68,7 +67,7 @@ abstract class Entity { public static function fromRow(array $row) { $instance = new static(); - foreach($row as $key => $value){ + foreach ($row as $key => $value) { $prop = ucfirst($instance->columnToProperty($key)); $setter = 'set' . $prop; $instance->$setter($value); @@ -103,18 +102,17 @@ abstract class Entity { */ protected function setter($name, $args) { // setters should only work for existing attributes - if(property_exists($this, $name)){ - if($this->$name === $args[0]) { + if (property_exists($this, $name)) { + if ($this->$name === $args[0]) { return; } $this->markFieldUpdated($name); // if type definition exists, cast to correct type - if($args[0] !== null && array_key_exists($name, $this->_fieldTypes)) { + if ($args[0] !== null && array_key_exists($name, $this->_fieldTypes)) { settype($args[0], $this->_fieldTypes[$name]); } $this->$name = $args[0]; - } else { throw new \BadFunctionCallException($name . ' is not a valid attribute'); @@ -127,7 +125,7 @@ abstract class Entity { */ protected function getter($name) { // getters should only work for existing attributes - if(property_exists($this, $name)){ + if (property_exists($this, $name)) { return $this->$name; } else { throw new \BadFunctionCallException($name . @@ -154,7 +152,6 @@ abstract class Entity { throw new \BadFunctionCallException($methodName . ' does not exist'); } - } /** @@ -190,8 +187,8 @@ abstract class Entity { $parts = explode('_', $columnName); $property = null; - foreach($parts as $part){ - if($property === null){ + foreach ($parts as $part) { + if ($property === null) { $property = $part; } else { $property .= ucfirst($part); @@ -212,8 +209,8 @@ abstract class Entity { $parts = preg_split('/(?=[A-Z])/', $property); $column = null; - foreach($parts as $part){ - if($column === null){ + foreach ($parts as $part) { + if ($column === null) { $column = $part; } else { $column .= '_' . lcfirst($part); @@ -254,7 +251,7 @@ abstract class Entity { */ public function slugify($attributeName) { // toSlug should only work for existing attributes - if(property_exists($this, $attributeName)){ + if (property_exists($this, $attributeName)) { $value = $this->$attributeName; // replace everything except alphanumeric with a single '-' $value = preg_replace('/[^A-Za-z0-9]+/', '-', $value); @@ -266,5 +263,4 @@ abstract class Entity { ' is not a valid attribute'); } } - } diff --git a/lib/public/AppFramework/Db/IMapperException.php b/lib/public/AppFramework/Db/IMapperException.php index f8a1d96aa93..04f7e380f55 100644 --- a/lib/public/AppFramework/Db/IMapperException.php +++ b/lib/public/AppFramework/Db/IMapperException.php @@ -29,4 +29,5 @@ namespace OCP\AppFramework\Db; /** * @since 16.0.0 */ -interface IMapperException {} +interface IMapperException { +} diff --git a/lib/public/AppFramework/Db/Mapper.php b/lib/public/AppFramework/Db/Mapper.php index 289ac1d684d..b1deaee5412 100644 --- a/lib/public/AppFramework/Db/Mapper.php +++ b/lib/public/AppFramework/Db/Mapper.php @@ -36,7 +36,6 @@ use OCP\IDBConnection; * @deprecated 14.0.0 Move over to QBMapper */ abstract class Mapper { - protected $tableName; protected $entityClass; protected $db; @@ -55,7 +54,7 @@ abstract class Mapper { // if not given set the entity name to the class without the mapper part // cache it here for later use since reflection is slow - if($entityClass === null) { + if ($entityClass === null) { $this->entityClass = str_replace('Mapper', '', get_class($this)); } else { $this->entityClass = $entityClass; @@ -105,7 +104,7 @@ abstract class Mapper { // build the fields $i = 0; - foreach($properties as $property => $updated) { + foreach ($properties as $property => $updated) { $column = $entity->propertyToColumn($property); $getter = 'get' . ucfirst($property); @@ -113,14 +112,13 @@ abstract class Mapper { $values .= '?'; // only append colon if there are more entries - if($i < count($properties)-1){ + if ($i < count($properties)-1) { $columns .= ','; $values .= ','; } $params[] = $entity->$getter(); $i++; - } $sql = 'INSERT INTO `' . $this->tableName . '`(' . @@ -148,13 +146,13 @@ abstract class Mapper { public function update(Entity $entity) { // if entity wasn't changed it makes no sense to run a db query $properties = $entity->getUpdatedFields(); - if(count($properties) === 0) { + if (count($properties) === 0) { return $entity; } // entity needs an id $id = $entity->getId(); - if($id === null){ + if ($id === null) { throw new \InvalidArgumentException( 'Entity which should be updated has no id'); } @@ -169,15 +167,14 @@ abstract class Mapper { // build the fields $i = 0; - foreach($properties as $property => $updated) { - + foreach ($properties as $property => $updated) { $column = $entity->propertyToColumn($property); $getter = 'get' . ucfirst($property); $columns .= '`' . $column . '` = ?'; // only append colon if there are more entries - if($i < count($properties)-1){ + if ($i < count($properties)-1) { $columns .= ','; } @@ -275,7 +272,7 @@ abstract class Mapper { $stmt = $this->execute($sql, $params, $limit, $offset); $row = $stmt->fetch(); - if($row === false || $row === null){ + if ($row === false || $row === null) { $stmt->closeCursor(); $msg = $this->buildDebugMessage( 'Did expect one result but found none when executing', $sql, $params, $limit, $offset @@ -285,7 +282,7 @@ abstract class Mapper { $row2 = $stmt->fetch(); $stmt->closeCursor(); //MDB2 returns null, PDO and doctrine false when no row is available - if(! ($row2 === false || $row2 === null)) { + if (! ($row2 === false || $row2 === null)) { $msg = $this->buildDebugMessage( 'Did not expect more than one result when executing', $sql, $params, $limit, $offset ); @@ -344,7 +341,7 @@ abstract class Mapper { $entities = []; - while($row = $stmt->fetch()){ + while ($row = $stmt->fetch()) { $entities[] = $this->mapRowToEntity($row); } @@ -370,6 +367,4 @@ abstract class Mapper { 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 a3f211194c4..6b1a2ca7918 100644 --- a/lib/public/AppFramework/Db/MultipleObjectsReturnedException.php +++ b/lib/public/AppFramework/Db/MultipleObjectsReturnedException.php @@ -42,5 +42,4 @@ class MultipleObjectsReturnedException extends \Exception implements IMapperExce public function __construct($msg) { parent::__construct($msg); } - } diff --git a/lib/public/AppFramework/Db/QBMapper.php b/lib/public/AppFramework/Db/QBMapper.php index c7b4b877651..9b396965706 100644 --- a/lib/public/AppFramework/Db/QBMapper.php +++ b/lib/public/AppFramework/Db/QBMapper.php @@ -64,7 +64,7 @@ abstract class QBMapper { // if not given set the entity name to the class without the mapper part // cache it here for later use since reflection is slow - if($entityClass === null) { + if ($entityClass === null) { $this->entityClass = str_replace('Mapper', '', \get_class($this)); } else { $this->entityClass = $entityClass; @@ -117,7 +117,7 @@ abstract class QBMapper { $qb->insert($this->tableName); // build the fields - foreach($properties as $property => $updated) { + foreach ($properties as $property => $updated) { $column = $entity->propertyToColumn($property); $getter = 'get' . ucfirst($property); $value = $entity->$getter(); @@ -128,7 +128,7 @@ abstract class QBMapper { $qb->execute(); - if($entity->id === null) { + if ($entity->id === null) { // When autoincrement is used id is always an int $entity->setId((int)$qb->getLastInsertId()); } @@ -166,13 +166,13 @@ abstract class QBMapper { public function update(Entity $entity): Entity { // if entity wasn't changed it makes no sense to run a db query $properties = $entity->getUpdatedFields(); - if(\count($properties) === 0) { + if (\count($properties) === 0) { return $entity; } // entity needs an id $id = $entity->getId(); - if($id === null){ + if ($id === null) { throw new \InvalidArgumentException( 'Entity which should be updated has no id'); } @@ -186,7 +186,7 @@ abstract class QBMapper { $qb->update($this->tableName); // build the fields - foreach($properties as $property => $updated) { + foreach ($properties as $property => $updated) { $column = $entity->propertyToColumn($property); $getter = 'get' . ucfirst($property); $value = $entity->$getter(); @@ -217,11 +217,11 @@ abstract class QBMapper { protected function getParameterTypeForProperty(Entity $entity, string $property): int { $types = $entity->getFieldTypes(); - if(!isset($types[ $property ])) { + if (!isset($types[ $property ])) { return IQueryBuilder::PARAM_STR; } - switch($types[ $property ]) { + switch ($types[ $property ]) { case 'int': case 'integer': return IQueryBuilder::PARAM_INT; @@ -251,7 +251,7 @@ abstract class QBMapper { $cursor = $query->execute(); $row = $cursor->fetch(); - if($row === false) { + if ($row === false) { $cursor->closeCursor(); $msg = $this->buildDebugMessage( 'Did expect one result but found none when executing', $query @@ -261,7 +261,7 @@ abstract class QBMapper { $row2 = $cursor->fetch(); $cursor->closeCursor(); - if($row2 !== false) { + if ($row2 !== false) { $msg = $this->buildDebugMessage( 'Did not expect more than one result when executing', $query ); @@ -308,7 +308,7 @@ abstract class QBMapper { $entities = []; - while($row = $cursor->fetch()){ + while ($row = $cursor->fetch()) { $entities[] = $this->mapRowToEntity($row); } @@ -331,5 +331,4 @@ abstract class QBMapper { protected function findEntity(IQueryBuilder $query): Entity { return $this->mapRowToEntity($this->findOneQuery($query)); } - } diff --git a/lib/public/AppFramework/Http.php b/lib/public/AppFramework/Http.php index df1d8a5b966..e0b910325a0 100644 --- a/lib/public/AppFramework/Http.php +++ b/lib/public/AppFramework/Http.php @@ -34,7 +34,6 @@ namespace OCP\AppFramework; * @since 6.0.0 */ class Http { - const STATUS_CONTINUE = 100; const STATUS_SWITCHING_PROTOCOLS = 101; const STATUS_PROCESSING = 102; diff --git a/lib/public/AppFramework/Http/DataDisplayResponse.php b/lib/public/AppFramework/Http/DataDisplayResponse.php index 8e14b231522..a000f919960 100644 --- a/lib/public/AppFramework/Http/DataDisplayResponse.php +++ b/lib/public/AppFramework/Http/DataDisplayResponse.php @@ -88,5 +88,4 @@ class DataDisplayResponse extends Response { public function getData() { return $this->data; } - } diff --git a/lib/public/AppFramework/Http/DataResponse.php b/lib/public/AppFramework/Http/DataResponse.php index a978df49010..483b46ba5ab 100644 --- a/lib/public/AppFramework/Http/DataResponse.php +++ b/lib/public/AppFramework/Http/DataResponse.php @@ -83,6 +83,4 @@ class DataResponse extends Response { public function getData() { return $this->data; } - - } diff --git a/lib/public/AppFramework/Http/DownloadResponse.php b/lib/public/AppFramework/Http/DownloadResponse.php index c28550a0bbd..78381f0f08f 100644 --- a/lib/public/AppFramework/Http/DownloadResponse.php +++ b/lib/public/AppFramework/Http/DownloadResponse.php @@ -30,7 +30,6 @@ namespace OCP\AppFramework\Http; * @since 7.0.0 */ class DownloadResponse extends Response { - private $filename; private $contentType; @@ -49,6 +48,4 @@ class DownloadResponse extends Response { $this->addHeader('Content-Disposition', 'attachment; filename="' . $filename . '"'); $this->addHeader('Content-Type', $contentType); } - - } diff --git a/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php b/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php index 01336088895..fc32a024592 100644 --- a/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php +++ b/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php @@ -436,77 +436,77 @@ class EmptyContentSecurityPolicy { $policy .= "base-uri 'none';"; $policy .= "manifest-src 'self';"; - if(!empty($this->allowedScriptDomains) || $this->inlineScriptAllowed || $this->evalScriptAllowed) { + if (!empty($this->allowedScriptDomains) || $this->inlineScriptAllowed || $this->evalScriptAllowed) { $policy .= 'script-src '; - if(is_string($this->useJsNonce)) { + if (is_string($this->useJsNonce)) { $policy .= '\'nonce-'.base64_encode($this->useJsNonce).'\''; $allowedScriptDomains = array_flip($this->allowedScriptDomains); unset($allowedScriptDomains['\'self\'']); $this->allowedScriptDomains = array_flip($allowedScriptDomains); - if(count($allowedScriptDomains) !== 0) { + if (count($allowedScriptDomains) !== 0) { $policy .= ' '; } } - if(is_array($this->allowedScriptDomains)) { + if (is_array($this->allowedScriptDomains)) { $policy .= implode(' ', $this->allowedScriptDomains); } - if($this->inlineScriptAllowed) { + if ($this->inlineScriptAllowed) { $policy .= ' \'unsafe-inline\''; } - if($this->evalScriptAllowed) { + if ($this->evalScriptAllowed) { $policy .= ' \'unsafe-eval\''; } $policy .= ';'; } - if(!empty($this->allowedStyleDomains) || $this->inlineStyleAllowed) { + if (!empty($this->allowedStyleDomains) || $this->inlineStyleAllowed) { $policy .= 'style-src '; - if(is_array($this->allowedStyleDomains)) { + if (is_array($this->allowedStyleDomains)) { $policy .= implode(' ', $this->allowedStyleDomains); } - if($this->inlineStyleAllowed) { + if ($this->inlineStyleAllowed) { $policy .= ' \'unsafe-inline\''; } $policy .= ';'; } - if(!empty($this->allowedImageDomains)) { + if (!empty($this->allowedImageDomains)) { $policy .= 'img-src ' . implode(' ', $this->allowedImageDomains); $policy .= ';'; } - if(!empty($this->allowedFontDomains)) { + if (!empty($this->allowedFontDomains)) { $policy .= 'font-src ' . implode(' ', $this->allowedFontDomains); $policy .= ';'; } - if(!empty($this->allowedConnectDomains)) { + if (!empty($this->allowedConnectDomains)) { $policy .= 'connect-src ' . implode(' ', $this->allowedConnectDomains); $policy .= ';'; } - if(!empty($this->allowedMediaDomains)) { + if (!empty($this->allowedMediaDomains)) { $policy .= 'media-src ' . implode(' ', $this->allowedMediaDomains); $policy .= ';'; } - if(!empty($this->allowedObjectDomains)) { + if (!empty($this->allowedObjectDomains)) { $policy .= 'object-src ' . implode(' ', $this->allowedObjectDomains); $policy .= ';'; } - if(!empty($this->allowedFrameDomains)) { + if (!empty($this->allowedFrameDomains)) { $policy .= 'frame-src '; $policy .= implode(' ', $this->allowedFrameDomains); $policy .= ';'; } - if(!empty($this->allowedChildSrcDomains)) { + if (!empty($this->allowedChildSrcDomains)) { $policy .= 'child-src ' . implode(' ', $this->allowedChildSrcDomains); $policy .= ';'; } - if(!empty($this->allowedFrameAncestors)) { + if (!empty($this->allowedFrameAncestors)) { $policy .= 'frame-ancestors ' . implode(' ', $this->allowedFrameAncestors); $policy .= ';'; } diff --git a/lib/public/AppFramework/Http/ICallbackResponse.php b/lib/public/AppFramework/Http/ICallbackResponse.php index ca2f5f424ff..44be69548ca 100644 --- a/lib/public/AppFramework/Http/ICallbackResponse.php +++ b/lib/public/AppFramework/Http/ICallbackResponse.php @@ -40,5 +40,4 @@ interface ICallbackResponse { * @since 8.1.0 */ public function callback(IOutput $output); - } diff --git a/lib/public/AppFramework/Http/IOutput.php b/lib/public/AppFramework/Http/IOutput.php index 83d65857c16..888c9f45b23 100644 --- a/lib/public/AppFramework/Http/IOutput.php +++ b/lib/public/AppFramework/Http/IOutput.php @@ -75,5 +75,4 @@ interface IOutput { * @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 1d7a626d5cd..2827cd964ec 100644 --- a/lib/public/AppFramework/Http/JSONResponse.php +++ b/lib/public/AppFramework/Http/JSONResponse.php @@ -71,7 +71,7 @@ class JSONResponse extends Response { */ public function render() { $response = json_encode($this->data, JSON_HEX_TAG); - if($response === false) { + if ($response === false) { throw new \Exception(sprintf('Could not json_encode due to invalid ' . 'non UTF-8 characters in the array: %s', var_export($this->data, true))); } @@ -101,5 +101,4 @@ class JSONResponse extends Response { public function getData() { return $this->data; } - } diff --git a/lib/public/AppFramework/Http/OCSResponse.php b/lib/public/AppFramework/Http/OCSResponse.php index c80a300ca4f..39c3ad98819 100644 --- a/lib/public/AppFramework/Http/OCSResponse.php +++ b/lib/public/AppFramework/Http/OCSResponse.php @@ -37,7 +37,6 @@ namespace OCP\AppFramework\Http; * @deprecated 9.2.0 To implement an OCS endpoint extend the OCSController */ class OCSResponse extends Response { - private $data; private $format; private $statuscode; @@ -93,6 +92,4 @@ class OCSResponse extends Response { return \OC_API::renderResult($this->format, $r->getMeta(), $r->getData()); } - - } diff --git a/lib/public/AppFramework/Http/RedirectResponse.php b/lib/public/AppFramework/Http/RedirectResponse.php index dda90440d6d..28344866c03 100644 --- a/lib/public/AppFramework/Http/RedirectResponse.php +++ b/lib/public/AppFramework/Http/RedirectResponse.php @@ -33,7 +33,6 @@ use OCP\AppFramework\Http; * @since 7.0.0 */ class RedirectResponse extends Response { - private $redirectURL; /** @@ -57,6 +56,4 @@ class RedirectResponse extends Response { public function getRedirectURL() { return $this->redirectURL; } - - } diff --git a/lib/public/AppFramework/Http/RedirectToDefaultAppResponse.php b/lib/public/AppFramework/Http/RedirectToDefaultAppResponse.php index 9072ca8a059..f4b8f54f892 100644 --- a/lib/public/AppFramework/Http/RedirectToDefaultAppResponse.php +++ b/lib/public/AppFramework/Http/RedirectToDefaultAppResponse.php @@ -41,5 +41,4 @@ class RedirectToDefaultAppResponse extends RedirectResponse { public function __construct() { parent::__construct(\OC_Util::getDefaultPageUrl()); } - } diff --git a/lib/public/AppFramework/Http/Response.php b/lib/public/AppFramework/Http/Response.php index 0aacc2f3a58..a48580c789d 100644 --- a/lib/public/AppFramework/Http/Response.php +++ b/lib/public/AppFramework/Http/Response.php @@ -106,7 +106,7 @@ class Response { * @since 6.0.0 - return value was added in 7.0.0 */ public function cacheFor(int $cacheSeconds) { - if($cacheSeconds > 0) { + if ($cacheSeconds > 0) { $this->addHeader('Cache-Control', 'max-age=' . $cacheSeconds . ', must-revalidate'); // Old scool prama caching @@ -173,7 +173,7 @@ class Response { * @since 8.0.0 */ public function invalidateCookies(array $cookieNames) { - foreach($cookieNames as $cookieName) { + foreach ($cookieNames as $cookieName) { $this->invalidateCookie($cookieName); } return $this; @@ -198,10 +198,10 @@ class Response { */ public function addHeader($name, $value) { $name = trim($name); // always remove leading and trailing whitespace - // to be able to reliably check for security - // headers + // to be able to reliably check for security + // headers - if(is_null($value)) { + if (is_null($value)) { unset($this->headers[$name]); } else { $this->headers[$name] = $value; @@ -232,7 +232,7 @@ class Response { public function getHeaders() { $mergeWith = []; - if($this->lastModified) { + if ($this->lastModified) { $mergeWith['Last-Modified'] = $this->lastModified->format(\DateTime::RFC2822); } @@ -240,7 +240,7 @@ class Response { $this->headers['Content-Security-Policy'] = $this->getContentSecurityPolicy()->buildPolicy(); $this->headers['Feature-Policy'] = $this->getFeaturePolicy()->buildPolicy(); - if($this->ETag) { + if ($this->ETag) { $mergeWith['ETag'] = '"' . $this->ETag . '"'; } diff --git a/lib/public/AppFramework/Http/StandaloneTemplateResponse.php b/lib/public/AppFramework/Http/StandaloneTemplateResponse.php index 544ad31f0d6..f07e82fc928 100644 --- a/lib/public/AppFramework/Http/StandaloneTemplateResponse.php +++ b/lib/public/AppFramework/Http/StandaloneTemplateResponse.php @@ -35,5 +35,4 @@ namespace OCP\AppFramework\Http; * @since 16.0.0 */ class StandaloneTemplateResponse extends TemplateResponse { - } diff --git a/lib/public/AppFramework/Http/StreamResponse.php b/lib/public/AppFramework/Http/StreamResponse.php index a228ed5566c..4deb4b4a859 100644 --- a/lib/public/AppFramework/Http/StreamResponse.php +++ b/lib/public/AppFramework/Http/StreamResponse.php @@ -65,5 +65,4 @@ class StreamResponse extends Response implements ICallbackResponse { } } } - } diff --git a/lib/public/AppFramework/Http/Template/IMenuAction.php b/lib/public/AppFramework/Http/Template/IMenuAction.php index 703befd3e34..e2ab005a050 100644 --- a/lib/public/AppFramework/Http/Template/IMenuAction.php +++ b/lib/public/AppFramework/Http/Template/IMenuAction.php @@ -61,5 +61,4 @@ interface IMenuAction { * @return string */ public function render(): string; - } diff --git a/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php b/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php index 67fe6165eef..8a8ac4242ce 100644 --- a/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php +++ b/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php @@ -35,7 +35,6 @@ use OCP\AppFramework\Http\TemplateResponse; * @since 14.0.0 */ class PublicTemplateResponse extends TemplateResponse { - private $headerTitle = ''; private $headerDetails = ''; private $headerActions = []; @@ -156,5 +155,4 @@ class PublicTemplateResponse extends TemplateResponse { $this->setParams($params); return parent::render(); } - } diff --git a/lib/public/AppFramework/Http/Template/SimpleMenuAction.php b/lib/public/AppFramework/Http/Template/SimpleMenuAction.php index 6c45d9e4d9d..65880857bb6 100644 --- a/lib/public/AppFramework/Http/Template/SimpleMenuAction.php +++ b/lib/public/AppFramework/Http/Template/SimpleMenuAction.php @@ -123,5 +123,4 @@ class SimpleMenuAction implements IMenuAction { Util::sanitizeHTML($this->id), Util::sanitizeHTML($this->link), Util::sanitizeHTML($this->icon), Util::sanitizeHTML($this->label), $detailContent ); } - } diff --git a/lib/public/AppFramework/Http/TemplateResponse.php b/lib/public/AppFramework/Http/TemplateResponse.php index 504b4af93ff..283189a774a 100644 --- a/lib/public/AppFramework/Http/TemplateResponse.php +++ b/lib/public/AppFramework/Http/TemplateResponse.php @@ -38,7 +38,6 @@ namespace OCP\AppFramework\Http; * @since 6.0.0 */ class TemplateResponse extends Response { - const EVENT_LOAD_ADDITIONAL_SCRIPTS = self::class . '::loadAdditionalScripts'; const EVENT_LOAD_ADDITIONAL_SCRIPTS_LOGGEDIN = self::class . '::loadAdditionalScriptsLoggedIn'; @@ -160,11 +159,10 @@ class TemplateResponse extends Response { $template = new \OCP\Template($this->appName, $this->templateName, $renderAs); - foreach($this->params as $key => $value){ + foreach ($this->params as $key => $value) { $template->assign($key, $value); } return $template->fetchPage($this->params); } - } diff --git a/lib/public/AppFramework/IAppContainer.php b/lib/public/AppFramework/IAppContainer.php index 68c30634fb2..5732a8b221e 100644 --- a/lib/public/AppFramework/IAppContainer.php +++ b/lib/public/AppFramework/IAppContainer.php @@ -62,5 +62,5 @@ interface IAppContainer extends IContainer { * @param string $serviceName e.g. 'OCA\Files\Capabilities' * @since 8.2.0 */ - public function registerCapability($serviceName); + public function registerCapability($serviceName); } diff --git a/lib/public/AppFramework/Middleware.php b/lib/public/AppFramework/Middleware.php index 2cf27fc14fd..73079614ec1 100644 --- a/lib/public/AppFramework/Middleware.php +++ b/lib/public/AppFramework/Middleware.php @@ -53,7 +53,6 @@ abstract class Middleware { * @since 6.0.0 */ public function beforeController($controller, $methodName) { - } @@ -107,5 +106,4 @@ abstract class Middleware { public function beforeOutput($controller, $methodName, $output) { return $output; } - } diff --git a/lib/public/AppFramework/OCS/OCSBadRequestException.php b/lib/public/AppFramework/OCS/OCSBadRequestException.php index eeea8ebaf47..d7d7c6e0439 100644 --- a/lib/public/AppFramework/OCS/OCSBadRequestException.php +++ b/lib/public/AppFramework/OCS/OCSBadRequestException.php @@ -43,5 +43,4 @@ class OCSBadRequestException extends OCSException { public function __construct($message = '', Exception $previous = null) { parent::__construct($message, Http::STATUS_BAD_REQUEST, $previous); } - } diff --git a/lib/public/AppFramework/OCS/OCSException.php b/lib/public/AppFramework/OCS/OCSException.php index 6f776595fc2..0cf07e83b0c 100644 --- a/lib/public/AppFramework/OCS/OCSException.php +++ b/lib/public/AppFramework/OCS/OCSException.php @@ -31,4 +31,5 @@ use Exception; * @package OCP\AppFramework * @since 9.1.0 */ -class OCSException extends Exception {} +class OCSException extends Exception { +} diff --git a/lib/public/AppFramework/OCSController.php b/lib/public/AppFramework/OCSController.php index d7243bb4d68..a800d31c6e9 100644 --- a/lib/public/AppFramework/OCSController.php +++ b/lib/public/AppFramework/OCSController.php @@ -110,5 +110,4 @@ abstract class OCSController extends ApiController { } return new \OC\AppFramework\OCS\V2Response($data, $format); } - } diff --git a/lib/public/AppFramework/PublicShareController.php b/lib/public/AppFramework/PublicShareController.php index d7857073619..4548f885133 100644 --- a/lib/public/AppFramework/PublicShareController.php +++ b/lib/public/AppFramework/PublicShareController.php @@ -133,6 +133,5 @@ abstract class PublicShareController extends Controller { * @since 14.0.0 */ public function shareNotFound() { - } } diff --git a/lib/public/AppFramework/QueryException.php b/lib/public/AppFramework/QueryException.php index b76a4914d90..fc00f275ae0 100644 --- a/lib/public/AppFramework/QueryException.php +++ b/lib/public/AppFramework/QueryException.php @@ -31,4 +31,5 @@ use Exception; * @package OCP\AppFramework * @since 8.1.0 */ -class QueryException extends Exception {} +class QueryException extends Exception { +} diff --git a/lib/public/AppFramework/Utility/IControllerMethodReflector.php b/lib/public/AppFramework/Utility/IControllerMethodReflector.php index 0f82f0306c2..cac61960bef 100644 --- a/lib/public/AppFramework/Utility/IControllerMethodReflector.php +++ b/lib/public/AppFramework/Utility/IControllerMethodReflector.php @@ -72,5 +72,4 @@ interface IControllerMethodReflector { * @since 8.0.0 */ public function hasAnnotation(string $name): bool; - } diff --git a/lib/public/AppFramework/Utility/ITimeFactory.php b/lib/public/AppFramework/Utility/ITimeFactory.php index 2ab10986f19..ce09f10160f 100644 --- a/lib/public/AppFramework/Utility/ITimeFactory.php +++ b/lib/public/AppFramework/Utility/ITimeFactory.php @@ -46,5 +46,4 @@ interface ITimeFactory { * @since 15.0.0 */ public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime; - } |