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 /apps/dav/lib/DAV | |
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 'apps/dav/lib/DAV')
-rw-r--r-- | apps/dav/lib/DAV/CustomPropertiesBackend.php | 1 | ||||
-rw-r--r-- | apps/dav/lib/DAV/GroupPrincipalBackend.php | 3 | ||||
-rw-r--r-- | apps/dav/lib/DAV/PublicAuth.php | 1 | ||||
-rw-r--r-- | apps/dav/lib/DAV/Sharing/Backend.php | 7 | ||||
-rw-r--r-- | apps/dav/lib/DAV/Sharing/IShareable.php | 1 | ||||
-rw-r--r-- | apps/dav/lib/DAV/Sharing/Plugin.php | 8 | ||||
-rw-r--r-- | apps/dav/lib/DAV/Sharing/Xml/Invite.php | 10 | ||||
-rw-r--r-- | apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php | 6 | ||||
-rw-r--r-- | apps/dav/lib/DAV/SystemPrincipalBackend.php | 1 |
9 files changed, 6 insertions, 32 deletions
diff --git a/apps/dav/lib/DAV/CustomPropertiesBackend.php b/apps/dav/lib/DAV/CustomPropertiesBackend.php index a50f171f6f3..b25c33add82 100644 --- a/apps/dav/lib/DAV/CustomPropertiesBackend.php +++ b/apps/dav/lib/DAV/CustomPropertiesBackend.php @@ -236,7 +236,6 @@ class CustomPropertiesBackend implements BackendInterface { * @return bool */ private function updateProperties(string $path, array $properties) { - $deleteStatement = 'DELETE FROM `*PREFIX*properties`' . ' WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` = ?'; diff --git a/apps/dav/lib/DAV/GroupPrincipalBackend.php b/apps/dav/lib/DAV/GroupPrincipalBackend.php index 04fe0223607..f03c7cc2bdd 100644 --- a/apps/dav/lib/DAV/GroupPrincipalBackend.php +++ b/apps/dav/lib/DAV/GroupPrincipalBackend.php @@ -36,7 +36,6 @@ use Sabre\DAV\PropPatch; use Sabre\DAVACL\PrincipalBackend\BackendInterface; class GroupPrincipalBackend implements BackendInterface { - const PRINCIPAL_PREFIX = 'principals/groups'; /** @var IGroupManager */ @@ -78,7 +77,7 @@ class GroupPrincipalBackend implements BackendInterface { $principals = []; if ($prefixPath === self::PRINCIPAL_PREFIX) { - foreach($this->groupManager->search('') as $user) { + foreach ($this->groupManager->search('') as $user) { $principals[] = $this->groupToPrincipal($user); } } diff --git a/apps/dav/lib/DAV/PublicAuth.php b/apps/dav/lib/DAV/PublicAuth.php index ad917fb4b76..407f1a2853f 100644 --- a/apps/dav/lib/DAV/PublicAuth.php +++ b/apps/dav/lib/DAV/PublicAuth.php @@ -68,7 +68,6 @@ class PublicAuth implements BackendInterface { * @return array */ function check(RequestInterface $request, ResponseInterface $response) { - if ($this->isRequestPublic($request)) { return [true, "principals/system/public"]; } diff --git a/apps/dav/lib/DAV/Sharing/Backend.php b/apps/dav/lib/DAV/Sharing/Backend.php index bb04918716e..ae69e33387c 100644 --- a/apps/dav/lib/DAV/Sharing/Backend.php +++ b/apps/dav/lib/DAV/Sharing/Backend.php @@ -70,13 +70,13 @@ class Backend { * @param string[] $remove */ public function updateShares(IShareable $shareable, array $add, array $remove) { - foreach($add as $element) { + foreach ($add as $element) { $principal = $this->principalBackend->findByUri($element['href'], ''); if ($principal !== '') { $this->shareWith($shareable, $element); } } - foreach($remove as $element) { + foreach ($remove as $element) { $principal = $this->principalBackend->findByUri($element, ''); if ($principal !== '') { $this->unshare($shareable, $element); @@ -195,7 +195,7 @@ class Backend { ->execute(); $shares = []; - while($row = $result->fetch()) { + while ($row = $result->fetch()) { $p = $this->principalBackend->getPrincipalByPath($row['principaluri']); $shares[]= [ 'href' => "principal:${row['principaluri']}", @@ -218,7 +218,6 @@ class Backend { * @return array */ public function applyShareAcl($resourceId, $acl) { - $shares = $this->getShares($resourceId); foreach ($shares as $share) { $acl[] = [ diff --git a/apps/dav/lib/DAV/Sharing/IShareable.php b/apps/dav/lib/DAV/Sharing/IShareable.php index 7da6549ee4f..1293721040a 100644 --- a/apps/dav/lib/DAV/Sharing/IShareable.php +++ b/apps/dav/lib/DAV/Sharing/IShareable.php @@ -74,5 +74,4 @@ interface IShareable extends INode { * @return string */ public function getOwner(); - } diff --git a/apps/dav/lib/DAV/Sharing/Plugin.php b/apps/dav/lib/DAV/Sharing/Plugin.php index f0c2b82ccbf..67eed9c9b4a 100644 --- a/apps/dav/lib/DAV/Sharing/Plugin.php +++ b/apps/dav/lib/DAV/Sharing/Plugin.php @@ -37,7 +37,6 @@ use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; class Plugin extends ServerPlugin { - const NS_OWNCLOUD = 'http://owncloud.org/ns'; const NS_NEXTCLOUD = 'http://nextcloud.com/ns'; @@ -117,13 +116,13 @@ class Plugin extends ServerPlugin { * @return null|false */ function httpPost(RequestInterface $request, ResponseInterface $response) { - $path = $request->getPath(); // Only handling xml $contentType = $request->getHeader('Content-Type'); - if (strpos($contentType, 'application/xml') === false && strpos($contentType, 'text/xml') === false) + if (strpos($contentType, 'application/xml') === false && strpos($contentType, 'text/xml') === false) { return; + } // Making sure the node exists try { @@ -191,14 +190,11 @@ class Plugin extends ServerPlugin { */ function propFind(PropFind $propFind, INode $node) { if ($node instanceof IShareable) { - $propFind->handle('{' . Plugin::NS_OWNCLOUD . '}invite', function () use ($node) { return new Invite( $node->getShares() ); }); - } } - } diff --git a/apps/dav/lib/DAV/Sharing/Xml/Invite.php b/apps/dav/lib/DAV/Sharing/Xml/Invite.php index 7852fa8431b..68aab171ab7 100644 --- a/apps/dav/lib/DAV/Sharing/Xml/Invite.php +++ b/apps/dav/lib/DAV/Sharing/Xml/Invite.php @@ -85,10 +85,8 @@ class Invite implements XmlSerializable { * @param array $users */ function __construct(array $users, array $organizer = null) { - $this->users = $users; $this->organizer = $organizer; - } /** @@ -97,9 +95,7 @@ class Invite implements XmlSerializable { * @return array */ function getValue() { - return $this->users; - } /** @@ -122,11 +118,9 @@ class Invite implements XmlSerializable { * @return void */ function xmlSerialize(Writer $writer) { - $cs = '{' . Plugin::NS_OWNCLOUD . '}'; if (!is_null($this->organizer)) { - $writer->startElement($cs . 'organizer'); $writer->writeElement('{DAV:}href', $this->organizer['href']); @@ -140,11 +134,9 @@ class Invite implements XmlSerializable { $writer->writeElement($cs . 'last-name', $this->organizer['lastName']); } $writer->endElement(); // organizer - } foreach ($this->users as $user) { - $writer->startElement($cs . 'user'); $writer->writeElement('{DAV:}href', $user['href']); if (isset($user['commonName']) && $user['commonName']) { @@ -165,8 +157,6 @@ class Invite implements XmlSerializable { } $writer->endElement(); //user - } - } } diff --git a/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php b/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php index c63bb4fe1d1..d76e65aa232 100644 --- a/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php +++ b/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php @@ -28,7 +28,6 @@ use Sabre\Xml\Reader; use Sabre\Xml\XmlDeserializable; class ShareRequest implements XmlDeserializable { - public $set = []; public $remove = []; @@ -40,14 +39,11 @@ class ShareRequest implements XmlDeserializable { * @param array $remove */ function __construct(array $set, array $remove) { - $this->set = $set; $this->remove = $remove; - } static function xmlDeserialize(Reader $reader) { - $elements = $reader->parseInnerTree([ '{' . Plugin::NS_OWNCLOUD. '}set' => 'Sabre\\Xml\\Element\\KeyValue', '{' . Plugin::NS_OWNCLOUD . '}remove' => 'Sabre\\Xml\\Element\\KeyValue', @@ -81,7 +77,5 @@ class ShareRequest implements XmlDeserializable { } return new self($set, $remove); - } - } diff --git a/apps/dav/lib/DAV/SystemPrincipalBackend.php b/apps/dav/lib/DAV/SystemPrincipalBackend.php index 6c1c5a932fb..c369f4da375 100644 --- a/apps/dav/lib/DAV/SystemPrincipalBackend.php +++ b/apps/dav/lib/DAV/SystemPrincipalBackend.php @@ -69,7 +69,6 @@ class SystemPrincipalBackend extends AbstractBackend { * @return array */ function getPrincipalByPath($path) { - if ($path === 'principals/system/system') { $principal = [ 'uri' => 'principals/system/system', |