coding style fixes

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2020-07-30 21:18:20 +02:00
parent b79e34c57b
commit 04521c6afc
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
2 changed files with 38 additions and 37 deletions

View File

@ -165,7 +165,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
'{DAV:}displayname' => $row['displayname'],
'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
];
$this->addOwnerPrincipal($addressBooks[$row['id']]);
@ -179,7 +179,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
$principals = array_map(function ($principal) {
return urldecode($principal);
}, $principals);
$principals[]= $principalUri;
$principals[] = $principalUri;
$query = $this->db->getQueryBuilder();
$result = $query->select(['a.id', 'a.uri', 'a.displayname', 'a.principaluri', 'a.description', 'a.synctoken', 's.access'])
@ -197,7 +197,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
continue;
}
$readOnly = (int) $row['access'] === Backend::ACCESS_READ;
$readOnly = (int)$row['access'] === Backend::ACCESS_READ;
if (isset($addressBooks[$row['id']])) {
if ($readOnly) {
// New share can not have more permissions then the old one.
@ -221,7 +221,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
'{DAV:}displayname' => $displayName,
'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $row['principaluri'],
$readOnlyPropertyName => $readOnly,
];
@ -251,7 +251,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
'{DAV:}displayname' => $row['displayname'],
'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
];
$this->addOwnerPrincipal($addressBooks[$row['id']]);
@ -298,7 +298,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
'{DAV:}displayname' => $row['displayname'],
'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
];
$this->addOwnerPrincipal($addressBook);
@ -332,7 +332,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
'{DAV:}displayname' => $row['displayname'],
'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
];
$this->addOwnerPrincipal($addressBook);
@ -367,7 +367,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
*/
$propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) {
$updates = [];
foreach ($mutations as $property=>$newValue) {
foreach ($mutations as $property => $newValue) {
switch ($property) {
case '{DAV:}displayname':
$updates['displayname'] = $newValue;
@ -380,7 +380,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
$query = $this->db->getQueryBuilder();
$query->update('addressbooks');
foreach ($updates as $key=>$value) {
foreach ($updates as $key => $value) {
$query->set($key, $query->createNamedParameter($value));
}
$query->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId)))
@ -410,7 +410,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
'synctoken' => 1
];
foreach ($properties as $property=>$newValue) {
foreach ($properties as $property => $newValue) {
switch ($property) {
case '{DAV:}displayname':
$values['displayname'] = $newValue;
@ -636,7 +636,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
->andWhere($q->expr()->eq('uid', $q->createNamedParameter($uid)))
->setMaxResults(1);
$result = $q->execute();
$count = (bool) $result->fetchColumn();
$count = (bool)$result->fetchColumn();
$result->closeCursor();
if ($count) {
throw new \Sabre\DAV\Exception\BadRequest('VCard object with uid already exists in this addressbook collection.');
@ -825,7 +825,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
public function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) {
// Current synctoken
$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*addressbooks` WHERE `id` = ?');
$stmt->execute([ $addressBookId ]);
$stmt->execute([$addressBookId]);
$currentToken = $stmt->fetchColumn(0);
if (is_null($currentToken)) {
@ -841,7 +841,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
if ($syncToken) {
$query = "SELECT `uri`, `operation` FROM `*PREFIX*addressbookchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `addressbookid` = ? ORDER BY `synctoken`";
if ($limit>0) {
if ($limit > 0) {
$query .= " LIMIT " . (int)$limit;
}
@ -909,7 +909,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
* @param bool $modified
* @return string
*/
private function readBlob($cardData, &$modified=false) {
private function readBlob($cardData, &$modified = false) {
if (is_resource($cardData)) {
$cardData = stream_get_contents($cardData);
}
@ -1013,7 +1013,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
$matches = $result->fetchAll();
$result->closeCursor();
$matches = array_map(function ($match) {
return (int) $match['cardid'];
return (int)$match['cardid'];
}, $matches);
$query = $this->db->getQueryBuilder();
@ -1218,6 +1218,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
/**
* For shared address books the sharee is set in the ACL of the address book
*
* @param $addressBookId
* @param $acl
* @return array

View File

@ -146,14 +146,14 @@ class Notifier implements INotifier {
switch ($action->getLabel()) {
case 'accept':
$action->setParsedLabel(
(string) $l->t('Accept')
(string)$l->t('Accept')
)
->setPrimary(true);
break;
case 'decline':
$action->setParsedLabel(
(string) $l->t('Decline')
(string)$l->t('Decline')
);
break;
}