diff options
Diffstat (limited to 'apps')
95 files changed, 291 insertions, 291 deletions
diff --git a/apps/comments/lib/Notification/Notifier.php b/apps/comments/lib/Notification/Notifier.php index bdc8647fb7f..3b502c0c504 100644 --- a/apps/comments/lib/Notification/Notifier.php +++ b/apps/comments/lib/Notification/Notifier.php @@ -217,7 +217,7 @@ class Notifier implements INotifier { $placeholders[] = '{' . $placeholder . '}'; if ($parameter['type'] === 'user') { $replacements[] = '@' . $parameter['name']; - } else if ($parameter['type'] === 'file') { + } elseif ($parameter['type'] === 'file') { $replacements[] = $parameter['path']; } else { $replacements[] = $parameter['name']; diff --git a/apps/dav/lib/AppInfo/Application.php b/apps/dav/lib/AppInfo/Application.php index 64a1f738a70..caad7bf040b 100644 --- a/apps/dav/lib/AppInfo/Application.php +++ b/apps/dav/lib/AppInfo/Application.php @@ -224,7 +224,7 @@ class Application extends App { $subject = Event::SUBJECT_OBJECT_ADD; if ($eventName === '\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject') { $subject = Event::SUBJECT_OBJECT_UPDATE; - } else if ($eventName === '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject') { + } elseif ($eventName === '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject') { $subject = Event::SUBJECT_OBJECT_DELETE; } $backend->onTouchCalendarObject( diff --git a/apps/dav/lib/CalDAV/Activity/Backend.php b/apps/dav/lib/CalDAV/Activity/Backend.php index d0232cde1b1..804b88d0322 100644 --- a/apps/dav/lib/CalDAV/Activity/Backend.php +++ b/apps/dav/lib/CalDAV/Activity/Backend.php @@ -216,7 +216,7 @@ class Backend { if ($owner === $event->getAuthor()) { $subject = Calendar::SUBJECT_UNSHARE_USER . '_you'; - } else if ($principal[2] === $event->getAuthor()) { + } elseif ($principal[2] === $event->getAuthor()) { $subject = Calendar::SUBJECT_UNSHARE_USER . '_self'; } else { $event->setAffectedUser($event->getAuthor()) @@ -230,7 +230,7 @@ class Backend { ->setSubject($subject, $parameters); $this->activityManager->publish($event); } - } else if ($principal[1] === 'groups') { + } elseif ($principal[1] === 'groups') { $this->triggerActivityGroup($principal[2], $event, $calendarData, Calendar::SUBJECT_UNSHARE_USER); $parameters = [ @@ -299,7 +299,7 @@ class Backend { ->setSubject($subject, $parameters); $this->activityManager->publish($event); } - } else if ($principal[1] === 'groups') { + } elseif ($principal[1] === 'groups') { $this->triggerActivityGroup($principal[2], $event, $calendarData, Calendar::SUBJECT_SHARE_USER); $parameters = [ @@ -422,7 +422,7 @@ class Backend { if ($object['type'] === 'todo' && strpos($action, Event::SUBJECT_OBJECT_UPDATE) === 0 && $object['status'] === 'COMPLETED') { $action .= '_completed'; - } else if ($object['type'] === 'todo' && strpos($action, Event::SUBJECT_OBJECT_UPDATE) === 0 && $object['status'] === 'NEEDS-ACTION') { + } elseif ($object['type'] === 'todo' && strpos($action, Event::SUBJECT_OBJECT_UPDATE) === 0 && $object['status'] === 'NEEDS-ACTION') { $action .= '_needs_action'; } @@ -499,7 +499,7 @@ class Backend { $prinical = explode('/', $share['{http://owncloud.org/ns}principal']); if ($prinical[1] === 'users') { $users[] = $prinical[2]; - } else if ($prinical[1] === 'groups') { + } elseif ($prinical[1] === 'groups') { $groups[] = $prinical[2]; } } diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php index 68814e88bcb..0a070810bdb 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php @@ -101,44 +101,44 @@ class Calendar extends Base { if ($event->getSubject() === self::SUBJECT_ADD) { $subject = $this->l->t('{actor} created calendar {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_ADD . '_self') { + } elseif ($event->getSubject() === self::SUBJECT_ADD . '_self') { $subject = $this->l->t('You created calendar {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_DELETE) { + } elseif ($event->getSubject() === self::SUBJECT_DELETE) { $subject = $this->l->t('{actor} deleted calendar {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_DELETE . '_self') { + } elseif ($event->getSubject() === self::SUBJECT_DELETE . '_self') { $subject = $this->l->t('You deleted calendar {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_UPDATE) { + } elseif ($event->getSubject() === self::SUBJECT_UPDATE) { $subject = $this->l->t('{actor} updated calendar {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_UPDATE . '_self') { + } elseif ($event->getSubject() === self::SUBJECT_UPDATE . '_self') { $subject = $this->l->t('You updated calendar {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_PUBLISH . '_self') { + } elseif ($event->getSubject() === self::SUBJECT_PUBLISH . '_self') { $subject = $this->l->t('You shared calendar {calendar} as public link'); - } else if ($event->getSubject() === self::SUBJECT_UNPUBLISH . '_self') { + } elseif ($event->getSubject() === self::SUBJECT_UNPUBLISH . '_self') { $subject = $this->l->t('You removed public link for calendar {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_SHARE_USER) { + } elseif ($event->getSubject() === self::SUBJECT_SHARE_USER) { $subject = $this->l->t('{actor} shared calendar {calendar} with you'); - } else if ($event->getSubject() === self::SUBJECT_SHARE_USER . '_you') { + } elseif ($event->getSubject() === self::SUBJECT_SHARE_USER . '_you') { $subject = $this->l->t('You shared calendar {calendar} with {user}'); - } else if ($event->getSubject() === self::SUBJECT_SHARE_USER . '_by') { + } elseif ($event->getSubject() === self::SUBJECT_SHARE_USER . '_by') { $subject = $this->l->t('{actor} shared calendar {calendar} with {user}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARE_USER) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARE_USER) { $subject = $this->l->t('{actor} unshared calendar {calendar} from you'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARE_USER . '_you') { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARE_USER . '_you') { $subject = $this->l->t('You unshared calendar {calendar} from {user}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARE_USER . '_by') { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARE_USER . '_by') { $subject = $this->l->t('{actor} unshared calendar {calendar} from {user}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARE_USER . '_self') { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARE_USER . '_self') { $subject = $this->l->t('{actor} unshared calendar {calendar} from themselves'); - } else if ($event->getSubject() === self::SUBJECT_SHARE_GROUP . '_you') { + } elseif ($event->getSubject() === self::SUBJECT_SHARE_GROUP . '_you') { $subject = $this->l->t('You shared calendar {calendar} with group {group}'); - } else if ($event->getSubject() === self::SUBJECT_SHARE_GROUP . '_by') { + } elseif ($event->getSubject() === self::SUBJECT_SHARE_GROUP . '_by') { $subject = $this->l->t('{actor} shared calendar {calendar} with group {group}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARE_GROUP . '_you') { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARE_GROUP . '_you') { $subject = $this->l->t('You unshared calendar {calendar} from group {group}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARE_GROUP . '_by') { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARE_GROUP . '_by') { $subject = $this->l->t('{actor} unshared calendar {calendar} from group {group}'); } else { throw new \InvalidArgumentException(); @@ -153,7 +153,7 @@ class Calendar extends Base { if (isset($parsedParameters['user'])) { // Couldn't group by calendar, maybe we can group by users $event = $this->eventMerger->mergeEvents('user', $event, $previousEvent); - } else if (isset($parsedParameters['group'])) { + } elseif (isset($parsedParameters['group'])) { // Couldn't group by calendar, maybe we can group by groups $event = $this->eventMerger->mergeEvents('group', $event, $previousEvent); } diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Event.php b/apps/dav/lib/CalDAV/Activity/Provider/Event.php index c554b2b6d20..9a71553fd31 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Event.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Event.php @@ -93,15 +93,15 @@ class Event extends Base { if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_event') { $subject = $this->l->t('{actor} created event {event} in calendar {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_event_self') { + } elseif ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_event_self') { $subject = $this->l->t('You created event {event} in calendar {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_event') { + } elseif ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_event') { $subject = $this->l->t('{actor} deleted event {event} from calendar {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_event_self') { + } elseif ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_event_self') { $subject = $this->l->t('You deleted event {event} from calendar {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_event') { + } elseif ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_event') { $subject = $this->l->t('{actor} updated event {event} in calendar {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_event_self') { + } elseif ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_event_self') { $subject = $this->l->t('You updated event {event} in calendar {calendar}'); } else { throw new \InvalidArgumentException(); diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php index 9e0fe769628..54339566823 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php @@ -50,24 +50,24 @@ class Todo extends Event { if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo') { $subject = $this->l->t('{actor} created todo {todo} in list {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo_self') { + } elseif ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo_self') { $subject = $this->l->t('You created todo {todo} in list {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo') { + } elseif ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo') { $subject = $this->l->t('{actor} deleted todo {todo} from list {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo_self') { + } elseif ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo_self') { $subject = $this->l->t('You deleted todo {todo} from list {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo') { + } elseif ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo') { $subject = $this->l->t('{actor} updated todo {todo} in list {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_self') { + } elseif ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_self') { $subject = $this->l->t('You updated todo {todo} in list {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed') { + } elseif ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed') { $subject = $this->l->t('{actor} solved todo {todo} in list {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self') { + } elseif ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self') { $subject = $this->l->t('You solved todo {todo} in list {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action') { + } elseif ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action') { $subject = $this->l->t('{actor} reopened todo {todo} in list {calendar}'); - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self') { + } elseif ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self') { $subject = $this->l->t('You reopened todo {todo} in list {calendar}'); } else { throw new \InvalidArgumentException(); diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index a6f1cef7095..9b96a4cfaaa 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -742,7 +742,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); } $values['components'] = implode(',',$properties[$sccs]->getValue()); - } else if (isset($properties['components'])) { + } elseif (isset($properties['components'])) { // Allow to provide components internally without having // to create a SupportedCalendarComponentSet object $values['components'] = $properties['components']; diff --git a/apps/dav/lib/CalDAV/Reminder/ReminderService.php b/apps/dav/lib/CalDAV/Reminder/ReminderService.php index 39fe4b248cb..48feaa0c589 100644 --- a/apps/dav/lib/CalDAV/Reminder/ReminderService.php +++ b/apps/dav/lib/CalDAV/Reminder/ReminderService.php @@ -511,7 +511,7 @@ class ReminderService { $users[] = $user; $userIds[] = $principal[2]; } - } else if ($principal[1] === 'groups') { + } elseif ($principal[1] === 'groups') { $groups[] = $principal[2]; } } diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php index 5493eb693f9..1e7d66d0772 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php @@ -516,7 +516,7 @@ class IMipPlugin extends SabreIMipPlugin { $template->setSubject('Cancelled: ' . $summary); $template->addHeading($l10n->t('Invitation canceled'), $l10n->t('Hello %s,', [$attendeeName])); $template->addBodyText($l10n->t('The meeting »%1$s« with %2$s was canceled.', [$summary, $inviteeName])); - } else if ($method === self::METHOD_REPLY) { + } elseif ($method === self::METHOD_REPLY) { $template->setSubject('Re: ' . $summary); $template->addHeading($l10n->t('Invitation updated'), $l10n->t('Hello %s,', [$attendeeName])); $template->addBodyText($l10n->t('The meeting »%1$s« with %2$s was updated.', [$summary, $inviteeName])); diff --git a/apps/dav/lib/CardDAV/AddressBookImpl.php b/apps/dav/lib/CardDAV/AddressBookImpl.php index fd1cd8827aa..01ebdcd7019 100644 --- a/apps/dav/lib/CardDAV/AddressBookImpl.php +++ b/apps/dav/lib/CardDAV/AddressBookImpl.php @@ -262,7 +262,7 @@ class AddressBookImpl implements IAddressBook { $result['PHOTO'] = 'VALUE=uri:' . $url; - } else if ($property->name === 'X-SOCIALPROFILE') { + } elseif ($property->name === 'X-SOCIALPROFILE') { $type = $this->getTypeFromProperty($property); // Type is the social network, when it's empty we don't need this. @@ -274,7 +274,7 @@ class AddressBookImpl implements IAddressBook { } // The following properties can be set multiple times - } else if (in_array($property->name, ['CLOUD', 'EMAIL', 'IMPP', 'TEL', 'URL', 'X-ADDRESSBOOKSERVER-MEMBER'])) { + } elseif (in_array($property->name, ['CLOUD', 'EMAIL', 'IMPP', 'TEL', 'URL', 'X-ADDRESSBOOKSERVER-MEMBER'])) { if (!isset($result[$property->name])) { $result[$property->name] = []; } diff --git a/apps/dav/lib/Connector/PublicAuth.php b/apps/dav/lib/Connector/PublicAuth.php index d92fbc68df3..59c5c0a38e6 100644 --- a/apps/dav/lib/Connector/PublicAuth.php +++ b/apps/dav/lib/Connector/PublicAuth.php @@ -104,7 +104,7 @@ class PublicAuth extends AbstractBasic { || $share->getShareType() === IShare::TYPE_CIRCLE) { if ($this->shareManager->checkPassword($share, $password)) { return true; - } else if ($this->session->exists('public_link_authenticated') + } elseif ($this->session->exists('public_link_authenticated') && $this->session->get('public_link_authenticated') === (string)$share->getId()) { return true; } else { @@ -116,7 +116,7 @@ class PublicAuth extends AbstractBasic { } return false; } - } else if ($share->getShareType() === IShare::TYPE_REMOTE) { + } elseif ($share->getShareType() === IShare::TYPE_REMOTE) { return true; } else { return false; diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index 125935fce5e..d025ba2aaca 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -328,7 +328,7 @@ class File extends Node implements IFile { $checksum = trim($this->request->server['HTTP_OC_CHECKSUM']); $this->fileView->putFileInfo($this->path, ['checksum' => $checksum]); $this->refreshInfo(); - } else if ($this->getChecksum() !== null && $this->getChecksum() !== '') { + } elseif ($this->getChecksum() !== null && $this->getChecksum() !== '') { $this->fileView->putFileInfo($this->path, ['checksum' => '']); $this->refreshInfo(); } @@ -592,7 +592,7 @@ class File extends Node implements IFile { if (isset($this->request->server['HTTP_OC_CHECKSUM'])) { $checksum = trim($this->request->server['HTTP_OC_CHECKSUM']); $this->fileView->putFileInfo($targetPath, ['checksum' => $checksum]); - } else if ($info->getChecksum() !== null && $info->getChecksum() !== '') { + } elseif ($info->getChecksum() !== null && $info->getChecksum() !== '') { $this->fileView->putFileInfo($this->path, ['checksum' => '']); } diff --git a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php index 1f7c78a5530..4c7c689bde3 100644 --- a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php @@ -196,7 +196,7 @@ class FilesReportPlugin extends ServerPlugin { $name = $reportProps['name']; if ($name === $ns . 'filter-rules') { $filterRules = $reportProps['value']; - } else if ($name === '{DAV:}prop') { + } elseif ($name === '{DAV:}prop') { // propfind properties foreach ($reportProps['value'] as $propVal) { $requestedProps[] = $propVal['name']; @@ -422,7 +422,7 @@ class FilesReportPlugin extends ServerPlugin { $entry = current($entry); if ($entry instanceof \OCP\Files\File) { $results[] = new File($this->fileView, $entry); - } else if ($entry instanceof \OCP\Files\Folder) { + } elseif ($entry instanceof \OCP\Files\Folder) { $results[] = new Directory($this->fileView, $entry); } } diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php index 73ebabdc48f..2acc783eecf 100644 --- a/apps/dav/lib/Connector/Sabre/Principal.php +++ b/apps/dav/lib/Connector/Sabre/Principal.php @@ -172,7 +172,7 @@ class Principal implements BackendInterface { if ($user !== null) { return $this->userToPrincipal($user); } - } else if ($prefix === 'principals/circles') { + } elseif ($prefix === 'principals/circles') { try { return $this->circleToPrincipal($name); } catch (QueryException $e) { diff --git a/apps/dav/lib/DAV/Sharing/Backend.php b/apps/dav/lib/DAV/Sharing/Backend.php index 1a813daa2e7..bb04918716e 100644 --- a/apps/dav/lib/DAV/Sharing/Backend.php +++ b/apps/dav/lib/DAV/Sharing/Backend.php @@ -232,7 +232,7 @@ class Backend { 'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'], 'protected' => true, ]; - } else if ($this->resourceType === 'calendar') { + } elseif ($this->resourceType === 'calendar') { // Allow changing the properties of read only calendars, // so users can change the visibility. $acl[] = [ diff --git a/apps/dav/lib/Upload/AssemblyStream.php b/apps/dav/lib/Upload/AssemblyStream.php index c17fe81bef7..560fc7c07bc 100644 --- a/apps/dav/lib/Upload/AssemblyStream.php +++ b/apps/dav/lib/Upload/AssemblyStream.php @@ -91,7 +91,7 @@ class AssemblyStream implements \Icewind\Streams\File { public function stream_seek($offset, $whence = SEEK_SET) { if ($whence === SEEK_CUR) { $offset = $this->stream_tell() + $offset; - } else if ($whence === SEEK_END) { + } elseif ($whence === SEEK_END) { $offset = $this->size + $offset; } diff --git a/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php b/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php index 4ef1f1bdda1..6cdfe04e8a9 100644 --- a/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php +++ b/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php @@ -143,7 +143,7 @@ class ImageExportPluginTest extends TestCase { ->willReturnCallback(function ($path) use ($card, $book) { if ($path === 'user/book/card') { return $card; - } else if ($path === 'user/book') { + } elseif ($path === 'user/book') { return $book; } $this->fail(); diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/Sapi.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/Sapi.php index e697d1153cd..ab5c9ec070d 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/Sapi.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/Sapi.php @@ -60,7 +60,7 @@ class Sapi { $copyStream = fopen('php://temp', 'r+'); if (is_string($response->getBody())) { fwrite($copyStream, $response->getBody()); - } else if (is_resource($response->getBody())) { + } elseif (is_resource($response->getBody())) { stream_copy_to_stream($response->getBody(), $copyStream); } rewind($copyStream); diff --git a/apps/encryption/lib/Crypto/Crypt.php b/apps/encryption/lib/Crypto/Crypt.php index acf19f5eb26..b8e7ebab85b 100644 --- a/apps/encryption/lib/Crypto/Crypt.php +++ b/apps/encryption/lib/Crypto/Crypt.php @@ -489,7 +489,7 @@ class Crypt { if (!$isCorrectHash && $enforceSignature) { throw new GenericEncryptionException('Bad Signature', $this->l->t('Bad Signature')); - } else if (!$isCorrectHash && !$enforceSignature) { + } elseif (!$isCorrectHash && !$enforceSignature) { $this->logger->info("Signature check skipped", ['app' => 'encryption']); } } diff --git a/apps/encryption/lib/Crypto/DecryptAll.php b/apps/encryption/lib/Crypto/DecryptAll.php index 1bb0dd0bc42..a488c726523 100644 --- a/apps/encryption/lib/Crypto/DecryptAll.php +++ b/apps/encryption/lib/Crypto/DecryptAll.php @@ -98,7 +98,7 @@ class DecryptAll { $useLoginPassword = $this->questionHelper->ask($input, $output, $questionUseLoginPassword); if ($useLoginPassword) { $question = new Question('Please enter the user\'s login password: '); - } else if ($this->util->isRecoveryEnabledForUser($user) === false) { + } elseif ($this->util->isRecoveryEnabledForUser($user) === false) { $output->writeln('No recovery key available for user ' . $user); return false; } else { diff --git a/apps/encryption/lib/KeyManager.php b/apps/encryption/lib/KeyManager.php index 3b06cbe2348..8b286e00942 100644 --- a/apps/encryption/lib/KeyManager.php +++ b/apps/encryption/lib/KeyManager.php @@ -433,7 +433,7 @@ class KeyManager { // when logged in, the master key is already decrypted in the session $privateKey = $this->session->getPrivateKey(); } - } else if ($publicAccess) { + } elseif ($publicAccess) { // use public share key for public links $uid = $this->getPublicShareKeyId(); $shareKey = $this->getShareKey($path, $uid); diff --git a/apps/encryption/tests/KeyManagerTest.php b/apps/encryption/tests/KeyManagerTest.php index 2e2fce2b349..02ab30f998c 100644 --- a/apps/encryption/tests/KeyManagerTest.php +++ b/apps/encryption/tests/KeyManagerTest.php @@ -388,7 +388,7 @@ class KeyManagerTest extends TestCase { $expectedUid = 'masterKeyId'; $this->configMock->expects($this->any())->method('getSystemValue')->with('secret') ->willReturn('password'); - } else if (!$uid) { + } elseif (!$uid) { $expectedUid = 'systemKeyId'; } else { $expectedUid = $uid; diff --git a/apps/federatedfilesharing/lib/AddressHandler.php b/apps/federatedfilesharing/lib/AddressHandler.php index 384a1e8c315..7ea3f304664 100644 --- a/apps/federatedfilesharing/lib/AddressHandler.php +++ b/apps/federatedfilesharing/lib/AddressHandler.php @@ -133,7 +133,7 @@ class AddressHandler { public function removeProtocolFromUrl($url) { if (strpos($url, 'https://') === 0) { return substr($url, strlen('https://')); - } else if (strpos($url, 'http://') === 0) { + } elseif (strpos($url, 'http://') === 0) { return substr($url, strlen('http://')); } diff --git a/apps/federatedfilesharing/lib/Notifier.php b/apps/federatedfilesharing/lib/Notifier.php index 348b7ef839e..23f866c6ae8 100644 --- a/apps/federatedfilesharing/lib/Notifier.php +++ b/apps/federatedfilesharing/lib/Notifier.php @@ -207,7 +207,7 @@ class Notifier implements INotifier { $user = $cloudId->getUser(); if (strpos($server, 'http://') === 0) { $server = substr($server, strlen('http://')); - } else if (strpos($server, 'https://') === 0) { + } elseif (strpos($server, 'https://') === 0) { $server = substr($server, strlen('https://')); } diff --git a/apps/federation/lib/DbHandler.php b/apps/federation/lib/DbHandler.php index b7d53d378d0..6adad5b69d1 100644 --- a/apps/federation/lib/DbHandler.php +++ b/apps/federation/lib/DbHandler.php @@ -302,7 +302,7 @@ class DbHandler { if (strpos($url, 'https://') === 0) { $normalized = substr($url, strlen('https://')); - } else if (strpos($url, 'http://') === 0) { + } elseif (strpos($url, 'http://') === 0) { $normalized = substr($url, strlen('http://')); } diff --git a/apps/files/lib/Activity/FavoriteProvider.php b/apps/files/lib/Activity/FavoriteProvider.php index bd794786d62..38d40fde047 100644 --- a/apps/files/lib/Activity/FavoriteProvider.php +++ b/apps/files/lib/Activity/FavoriteProvider.php @@ -105,7 +105,7 @@ class FavoriteProvider implements IProvider { } else { $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/starred.svg'))); } - } else if ($event->getSubject() === self::SUBJECT_REMOVED) { + } elseif ($event->getSubject() === self::SUBJECT_REMOVED) { $event->setType('unfavorite'); $event->setParsedSubject($this->l->t('Removed from favorites')); if ($this->activityManager->getRequirePNG()) { @@ -136,7 +136,7 @@ class FavoriteProvider implements IProvider { } else { $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/starred.svg'))); } - } else if ($event->getSubject() === self::SUBJECT_REMOVED) { + } elseif ($event->getSubject() === self::SUBJECT_REMOVED) { $event->setType('unfavorite'); $subject = $this->l->t('You removed {file} from your favorites'); if ($this->activityManager->getRequirePNG()) { diff --git a/apps/files/lib/Activity/Helper.php b/apps/files/lib/Activity/Helper.php index fd043bed950..df9ed7af909 100644 --- a/apps/files/lib/Activity/Helper.php +++ b/apps/files/lib/Activity/Helper.php @@ -52,7 +52,7 @@ class Helper { if (empty($favorites)) { throw new \RuntimeException('No favorites', 1); - } else if (isset($favorites[self::FAVORITE_LIMIT])) { + } elseif (isset($favorites[self::FAVORITE_LIMIT])) { throw new \RuntimeException('Too many favorites', 2); } diff --git a/apps/files/lib/Activity/Provider.php b/apps/files/lib/Activity/Provider.php index c8d2794a181..a9a9c948c0b 100644 --- a/apps/files/lib/Activity/Provider.php +++ b/apps/files/lib/Activity/Provider.php @@ -143,19 +143,19 @@ class Provider implements IProvider { if ($event->getSubject() === 'created_by') { $subject = $this->l->t('Created by {user}'); $this->setIcon($event, 'add-color'); - } else if ($event->getSubject() === 'changed_by') { + } elseif ($event->getSubject() === 'changed_by') { $subject = $this->l->t('Changed by {user}'); $this->setIcon($event, 'change'); - } else if ($event->getSubject() === 'deleted_by') { + } elseif ($event->getSubject() === 'deleted_by') { $subject = $this->l->t('Deleted by {user}'); $this->setIcon($event, 'delete-color'); - } else if ($event->getSubject() === 'restored_by') { + } elseif ($event->getSubject() === 'restored_by') { $subject = $this->l->t('Restored by {user}'); $this->setIcon($event, 'actions/history', 'core'); - } else if ($event->getSubject() === 'renamed_by') { + } elseif ($event->getSubject() === 'renamed_by') { $subject = $this->l->t('Renamed by {user}'); $this->setIcon($event, 'change'); - } else if ($event->getSubject() === 'moved_by') { + } elseif ($event->getSubject() === 'moved_by') { $subject = $this->l->t('Moved by {user}'); $this->setIcon($event, 'change'); } else { @@ -189,55 +189,55 @@ class Provider implements IProvider { $subject = $this->l->t('You created an encrypted file in {file}'); } $this->setIcon($event, 'add-color'); - } else if ($event->getSubject() === 'created_by') { + } elseif ($event->getSubject() === 'created_by') { $subject = $this->l->t('{user} created {file}'); if ($this->fileIsEncrypted) { $subject = $this->l->t('{user} created an encrypted file in {file}'); } $this->setIcon($event, 'add-color'); - } else if ($event->getSubject() === 'created_public') { + } elseif ($event->getSubject() === 'created_public') { $subject = $this->l->t('{file} was created in a public folder'); $this->setIcon($event, 'add-color'); - } else if ($event->getSubject() === 'changed_self') { + } elseif ($event->getSubject() === 'changed_self') { $subject = $this->l->t('You changed {file}'); if ($this->fileIsEncrypted) { $subject = $this->l->t('You changed an encrypted file in {file}'); } $this->setIcon($event, 'change'); - } else if ($event->getSubject() === 'changed_by') { + } elseif ($event->getSubject() === 'changed_by') { $subject = $this->l->t('{user} changed {file}'); if ($this->fileIsEncrypted) { $subject = $this->l->t('{user} changed an encrypted file in {file}'); } $this->setIcon($event, 'change'); - } else if ($event->getSubject() === 'deleted_self') { + } elseif ($event->getSubject() === 'deleted_self') { $subject = $this->l->t('You deleted {file}'); if ($this->fileIsEncrypted) { $subject = $this->l->t('You deleted an encrypted file in {file}'); } $this->setIcon($event, 'delete-color'); - } else if ($event->getSubject() === 'deleted_by') { + } elseif ($event->getSubject() === 'deleted_by') { $subject = $this->l->t('{user} deleted {file}'); if ($this->fileIsEncrypted) { $subject = $this->l->t('{user} deleted an encrypted file in {file}'); } $this->setIcon($event, 'delete-color'); - } else if ($event->getSubject() === 'restored_self') { + } elseif ($event->getSubject() === 'restored_self') { $subject = $this->l->t('You restored {file}'); $this->setIcon($event, 'actions/history', 'core'); - } else if ($event->getSubject() === 'restored_by') { + } elseif ($event->getSubject() === 'restored_by') { $subject = $this->l->t('{user} restored {file}'); $this->setIcon($event, 'actions/history', 'core'); - } else if ($event->getSubject() === 'renamed_self') { + } elseif ($event->getSubject() === 'renamed_self') { $subject = $this->l->t('You renamed {oldfile} to {newfile}'); $this->setIcon($event, 'change'); - } else if ($event->getSubject() === 'renamed_by') { + } elseif ($event->getSubject() === 'renamed_by') { $subject = $this->l->t('{user} renamed {oldfile} to {newfile}'); $this->setIcon($event, 'change'); - } else if ($event->getSubject() === 'moved_self') { + } elseif ($event->getSubject() === 'moved_self') { $subject = $this->l->t('You moved {oldfile} to {newfile}'); $this->setIcon($event, 'change'); - } else if ($event->getSubject() === 'moved_by') { + } elseif ($event->getSubject() === 'moved_by') { $subject = $this->l->t('{user} moved {oldfile} to {newfile}'); $this->setIcon($event, 'change'); } else { @@ -348,7 +348,7 @@ class Provider implements IProvider { if (is_array($parameter)) { $path = reset($parameter); $id = (string) key($parameter); - } else if ($event !== null) { + } elseif ($event !== null) { // Legacy from before ownCloud 8.2 $path = $parameter; $id = $event->getObjectId(); diff --git a/apps/files/lib/Command/Scan.php b/apps/files/lib/Command/Scan.php index f628ed2e0e0..024899e5f5c 100644 --- a/apps/files/lib/Command/Scan.php +++ b/apps/files/lib/Command/Scan.php @@ -175,7 +175,7 @@ class Scan extends Base { $inputPath = '/' . trim($inputPath, '/'); list(, $user,) = explode('/', $inputPath, 3); $users = [$user]; - } else if ($input->getOption('all')) { + } elseif ($input->getOption('all')) { $users = $this->userManager->search(''); } else { $users = $input->getArgument('user_id'); diff --git a/apps/files/lib/Helper.php b/apps/files/lib/Helper.php index 325ff89e6c2..b3a62aee1c5 100644 --- a/apps/files/lib/Helper.php +++ b/apps/files/lib/Helper.php @@ -260,7 +260,7 @@ class Helper { $sortFunc = 'compareFileNames'; if ($sortAttribute === 'mtime') { $sortFunc = 'compareTimestamp'; - } else if ($sortAttribute === 'size') { + } elseif ($sortAttribute === 'size') { $sortFunc = 'compareSize'; } usort($files, [Helper::class, $sortFunc]); diff --git a/apps/files_external/lib/Command/ListCommand.php b/apps/files_external/lib/Command/ListCommand.php index dbb309f3a2c..6fa493a6598 100644 --- a/apps/files_external/lib/Command/ListCommand.php +++ b/apps/files_external/lib/Command/ListCommand.php @@ -125,7 +125,7 @@ class ListCommand extends Base { } else { if ($userId === self::ALL) { $output->writeln("<info>No mounts configured</info>"); - } else if ($userId) { + } elseif ($userId) { $output->writeln("<info>No mounts configured by $userId</info>"); } else { $output->writeln("<info>No admin mounts configured</info>"); diff --git a/apps/files_external/lib/Command/Notify.php b/apps/files_external/lib/Command/Notify.php index 84966b4ee7b..6b83c570c67 100644 --- a/apps/files_external/lib/Command/Notify.php +++ b/apps/files_external/lib/Command/Notify.php @@ -105,16 +105,16 @@ class Notify extends Base { if ($input->getOption('user')) { $mount->setBackendOption('user', $input->getOption('user')); - } else if (isset($_ENV['NOTIFY_USER'])) { + } elseif (isset($_ENV['NOTIFY_USER'])) { $mount->setBackendOption('user', $_ENV['NOTIFY_USER']); - } else if (isset($_SERVER['NOTIFY_USER'])) { + } elseif (isset($_SERVER['NOTIFY_USER'])) { $mount->setBackendOption('user', $_SERVER['NOTIFY_USER']); } if ($input->getOption('password')) { $mount->setBackendOption('password', $input->getOption('password')); - } else if (isset($_ENV['NOTIFY_PASSWORD'])) { + } elseif (isset($_ENV['NOTIFY_PASSWORD'])) { $mount->setBackendOption('password', $_ENV['NOTIFY_PASSWORD']); - } else if (isset($_SERVER['NOTIFY_PASSWORD'])) { + } elseif (isset($_SERVER['NOTIFY_PASSWORD'])) { $mount->setBackendOption('password', $_SERVER['NOTIFY_PASSWORD']); } @@ -280,16 +280,16 @@ class Notify extends Base { foreach ($changes as $change) { if ($change->getPath() === '/.nc_test_file.txt' || $change->getPath() === '.nc_test_file.txt') { $foundRootChange = true; - } else if ($change->getPath() === '/.nc_test_folder/subfile.txt' || $change->getPath() === '.nc_test_folder/subfile.txt') { + } elseif ($change->getPath() === '/.nc_test_folder/subfile.txt' || $change->getPath() === '.nc_test_folder/subfile.txt') { $foundSubfolderChange = true; } } if ($foundRootChange && $foundSubfolderChange && $verbose) { $output->writeln('<info>Self-test successful</info>'); - } else if ($foundRootChange && !$foundSubfolderChange) { + } elseif ($foundRootChange && !$foundSubfolderChange) { $output->writeln('<error>Error while running self-test, change is subfolder not detected</error>'); - } else if (!$foundRootChange) { + } elseif (!$foundRootChange) { $output->writeln('<error>Error while running self-test, no changes detected</error>'); } } diff --git a/apps/files_external/lib/Lib/Notify/SMBNotifyHandler.php b/apps/files_external/lib/Lib/Notify/SMBNotifyHandler.php index b456f03c34d..15628ec965b 100644 --- a/apps/files_external/lib/Lib/Notify/SMBNotifyHandler.php +++ b/apps/files_external/lib/Lib/Notify/SMBNotifyHandler.php @@ -55,7 +55,7 @@ class SMBNotifyHandler implements INotifyHandler { private function relativePath($fullPath) { if ($fullPath === $this->root) { return ''; - } else if (substr($fullPath, 0, strlen($this->root)) === $this->root) { + } elseif (substr($fullPath, 0, strlen($this->root)) === $this->root) { return substr($fullPath, strlen($this->root)); } else { return null; diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index b8155e28661..99cfcb594a9 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -200,7 +200,7 @@ class AmazonS3 extends \OC\Files\Storage\Common { if (isset($storages[$this->id]) && isset($storages[$oldId])) { // if both ids exist, delete the old storage and corresponding filecache entries \OC\Files\Cache\Storage::remove($oldId); - } else if (isset($storages[$oldId])) { + } elseif (isset($storages[$oldId])) { // if only the old id exists do an update $stmt = \OC::$server->getDatabaseConnection()->prepare( 'UPDATE `*PREFIX*storages` SET `id` = ? WHERE `id` = ?' @@ -221,7 +221,7 @@ class AmazonS3 extends \OC\Files\Storage\Common { $fileType = $this->filetype($path); if ($fileType === 'dir') { return $this->rmdir($path); - } else if ($fileType === 'file') { + } elseif ($fileType === 'file') { return $this->unlink($path); } else { return false; diff --git a/apps/files_external/lib/Lib/Storage/OwnCloud.php b/apps/files_external/lib/Lib/Storage/OwnCloud.php index 966874e947a..1738aacd258 100644 --- a/apps/files_external/lib/Lib/Storage/OwnCloud.php +++ b/apps/files_external/lib/Lib/Storage/OwnCloud.php @@ -49,7 +49,7 @@ class OwnCloud extends \OC\Files\Storage\DAV implements IDisableEncryptionStorag if (substr($host, 0, 8) === "https://") { $host = substr($host, 8); $params['secure'] = true; - } else if (substr($host, 0, 7) === "http://") { + } elseif (substr($host, 0, 7) === "http://") { $host = substr($host, 7); $params['secure'] = false; } diff --git a/apps/files_external/lib/Lib/Storage/SFTP.php b/apps/files_external/lib/Lib/Storage/SFTP.php index ee848889c39..9682ebd4535 100644 --- a/apps/files_external/lib/Lib/Storage/SFTP.php +++ b/apps/files_external/lib/Lib/Storage/SFTP.php @@ -72,7 +72,7 @@ class SFTP extends \OC\Files\Storage\Common { $parsed = parse_url($host); if(is_array($parsed) && isset($parsed['port'])) { return [$parsed['host'], $parsed['port']]; - } else if (is_array($parsed)) { + } elseif (is_array($parsed)) { return [$parsed['host'], 22]; } else { return [$input, 22]; diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index 9cca8b72210..506774d5cea 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -96,7 +96,7 @@ class SMB extends Common implements INotifyStorage { if (isset($params['auth'])) { $auth = $params['auth']; - } else if (isset($params['user']) && isset($params['password']) && isset($params['share'])) { + } elseif (isset($params['user']) && isset($params['password']) && isset($params['share'])) { list($workgroup, $user) = $this->splitUser($params['user']); $auth = new BasicAuth($user, $workgroup, $params['password']); } else { @@ -161,7 +161,7 @@ class SMB extends Common implements INotifyStorage { protected function relativePath($fullPath) { if ($fullPath === $this->root) { return ''; - } else if (substr($fullPath, 0, strlen($this->root)) === $this->root) { + } elseif (substr($fullPath, 0, strlen($this->root)) === $this->root) { return substr($fullPath, strlen($this->root)); } else { return null; diff --git a/apps/files_external/lib/Lib/Storage/Swift.php b/apps/files_external/lib/Lib/Storage/Swift.php index 5a4b607bb6b..a928f5b75d9 100644 --- a/apps/files_external/lib/Lib/Storage/Swift.php +++ b/apps/files_external/lib/Lib/Storage/Swift.php @@ -324,7 +324,7 @@ class Swift extends \OC\Files\Storage\Common { if ($path === '.') { $path = ''; - } else if ($this->is_dir($path)) { + } elseif ($this->is_dir($path)) { $path .= '/'; } @@ -506,7 +506,7 @@ class Swift extends \OC\Files\Storage\Common { return false; } - } else if ($fileType === 'dir') { + } elseif ($fileType === 'dir') { try { $source = $this->fetchObject($path1 . '/'); $source->copy([ diff --git a/apps/files_external/lib/Service/LegacyStoragesService.php b/apps/files_external/lib/Service/LegacyStoragesService.php index 7818571c3d7..95807f0e53f 100644 --- a/apps/files_external/lib/Service/LegacyStoragesService.php +++ b/apps/files_external/lib/Service/LegacyStoragesService.php @@ -88,7 +88,7 @@ abstract class LegacyStoragesService { $applicableUsers[] = $applicable; $storageConfig->setApplicableUsers($applicableUsers); } - } else if ($mountType === \OC_Mount_Config::MOUNT_TYPE_GROUP) { + } elseif ($mountType === \OC_Mount_Config::MOUNT_TYPE_GROUP) { $applicableGroups = $storageConfig->getApplicableGroups(); $applicableGroups[] = $applicable; $storageConfig->setApplicableGroups($applicableGroups); diff --git a/apps/files_external/lib/Service/StoragesService.php b/apps/files_external/lib/Service/StoragesService.php index 60ccec13206..b348a0964ad 100644 --- a/apps/files_external/lib/Service/StoragesService.php +++ b/apps/files_external/lib/Service/StoragesService.php @@ -420,7 +420,7 @@ abstract class StoragesService { if ($wasGlobal && !$isGlobal) { $this->dbConfig->removeApplicable($id, DBConfigService::APPLICABLE_TYPE_GLOBAL, null); - } else if (!$wasGlobal && $isGlobal) { + } elseif (!$wasGlobal && $isGlobal) { $this->dbConfig->addApplicable($id, DBConfigService::APPLICABLE_TYPE_GLOBAL, null); } diff --git a/apps/files_sharing/lib/Activity/Providers/Base.php b/apps/files_sharing/lib/Activity/Providers/Base.php index b63eb346f7c..16e46aae991 100644 --- a/apps/files_sharing/lib/Activity/Providers/Base.php +++ b/apps/files_sharing/lib/Activity/Providers/Base.php @@ -147,7 +147,7 @@ abstract class Base implements IProvider { if (is_array($parameter)) { $path = reset($parameter); $id = (string) key($parameter); - } else if ($event !== null) { + } elseif ($event !== null) { // Legacy from before ownCloud 8.2 $path = $parameter; $id = $event->getObjectId(); diff --git a/apps/files_sharing/lib/Activity/Providers/Downloads.php b/apps/files_sharing/lib/Activity/Providers/Downloads.php index 706945060de..91ad8322e6f 100644 --- a/apps/files_sharing/lib/Activity/Providers/Downloads.php +++ b/apps/files_sharing/lib/Activity/Providers/Downloads.php @@ -46,7 +46,7 @@ class Downloads extends Base { if ($event->getSubject() === self::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED || $event->getSubject() === self::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED) { $subject = $this->l->t('Downloaded via public link'); - } else if ($event->getSubject() === self::SUBJECT_SHARED_FILE_BY_EMAIL_DOWNLOADED || + } elseif ($event->getSubject() === self::SUBJECT_SHARED_FILE_BY_EMAIL_DOWNLOADED || $event->getSubject() === self::SUBJECT_SHARED_FOLDER_BY_EMAIL_DOWNLOADED) { $subject = $this->l->t('Downloaded by {email}'); } else { @@ -75,7 +75,7 @@ class Downloads extends Base { if ($event->getSubject() === self::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED || $event->getSubject() === self::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED) { $subject = $this->l->t('{file} downloaded via public link'); - } else if ($event->getSubject() === self::SUBJECT_SHARED_FILE_BY_EMAIL_DOWNLOADED || + } elseif ($event->getSubject() === self::SUBJECT_SHARED_FILE_BY_EMAIL_DOWNLOADED || $event->getSubject() === self::SUBJECT_SHARED_FOLDER_BY_EMAIL_DOWNLOADED) { $subject = $this->l->t('{email} downloaded {file}'); } else { diff --git a/apps/files_sharing/lib/Activity/Providers/Groups.php b/apps/files_sharing/lib/Activity/Providers/Groups.php index 8a061f9373d..70e3c177e66 100644 --- a/apps/files_sharing/lib/Activity/Providers/Groups.php +++ b/apps/files_sharing/lib/Activity/Providers/Groups.php @@ -72,13 +72,13 @@ class Groups extends Base { if ($event->getSubject() === self::SUBJECT_SHARED_GROUP_SELF) { $subject = $this->l->t('Shared with group {group}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_GROUP_SELF) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_GROUP_SELF) { $subject = $this->l->t('Removed share for group {group}'); - } else if ($event->getSubject() === self::SUBJECT_RESHARED_GROUP_BY) { + } elseif ($event->getSubject() === self::SUBJECT_RESHARED_GROUP_BY) { $subject = $this->l->t('{actor} shared with group {group}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_GROUP_BY) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_GROUP_BY) { $subject = $this->l->t('{actor} removed share for group {group}'); - } else if ($event->getSubject() === self::SUBJECT_EXPIRED_GROUP) { + } elseif ($event->getSubject() === self::SUBJECT_EXPIRED_GROUP) { $subject = $this->l->t('Share for group {group} expired'); } else { throw new \InvalidArgumentException(); @@ -105,13 +105,13 @@ class Groups extends Base { if ($event->getSubject() === self::SUBJECT_SHARED_GROUP_SELF) { $subject = $this->l->t('You shared {file} with group {group}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_GROUP_SELF) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_GROUP_SELF) { $subject = $this->l->t('You removed group {group} from {file}'); - } else if ($event->getSubject() === self::SUBJECT_RESHARED_GROUP_BY) { + } elseif ($event->getSubject() === self::SUBJECT_RESHARED_GROUP_BY) { $subject = $this->l->t('{actor} shared {file} with group {group}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_GROUP_BY) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_GROUP_BY) { $subject = $this->l->t('{actor} removed group {group} from {file}'); - } else if ($event->getSubject() === self::SUBJECT_EXPIRED_GROUP) { + } elseif ($event->getSubject() === self::SUBJECT_EXPIRED_GROUP) { $subject = $this->l->t('Share for file {file} with group {group} expired'); } else { throw new \InvalidArgumentException(); diff --git a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php index 20b8414bee9..97fc66eaf69 100644 --- a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php +++ b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php @@ -45,15 +45,15 @@ class PublicLinks extends Base { if ($event->getSubject() === self::SUBJECT_SHARED_LINK_SELF) { $subject = $this->l->t('Shared as public link'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_LINK_SELF) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_LINK_SELF) { $subject = $this->l->t('Removed public link'); - } else if ($event->getSubject() === self::SUBJECT_LINK_EXPIRED) { + } elseif ($event->getSubject() === self::SUBJECT_LINK_EXPIRED) { $subject = $this->l->t('Public link expired'); - } else if ($event->getSubject() === self::SUBJECT_RESHARED_LINK_BY) { + } elseif ($event->getSubject() === self::SUBJECT_RESHARED_LINK_BY) { $subject = $this->l->t('{actor} shared as public link'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_LINK_BY) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_LINK_BY) { $subject = $this->l->t('{actor} removed public link'); - } else if ($event->getSubject() === self::SUBJECT_LINK_BY_EXPIRED) { + } elseif ($event->getSubject() === self::SUBJECT_LINK_BY_EXPIRED) { $subject = $this->l->t('Public link of {actor} expired'); } else { @@ -81,15 +81,15 @@ class PublicLinks extends Base { if ($event->getSubject() === self::SUBJECT_SHARED_LINK_SELF) { $subject = $this->l->t('You shared {file} as public link'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_LINK_SELF) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_LINK_SELF) { $subject = $this->l->t('You removed public link for {file}'); - } else if ($event->getSubject() === self::SUBJECT_LINK_EXPIRED) { + } elseif ($event->getSubject() === self::SUBJECT_LINK_EXPIRED) { $subject = $this->l->t('Public link expired for {file}'); - } else if ($event->getSubject() === self::SUBJECT_RESHARED_LINK_BY) { + } elseif ($event->getSubject() === self::SUBJECT_RESHARED_LINK_BY) { $subject = $this->l->t('{actor} shared {file} as public link'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_LINK_BY) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_LINK_BY) { $subject = $this->l->t('{actor} removed public link for {file}'); - } else if ($event->getSubject() === self::SUBJECT_LINK_BY_EXPIRED) { + } elseif ($event->getSubject() === self::SUBJECT_LINK_BY_EXPIRED) { $subject = $this->l->t('Public link of {actor} for {file} expired'); } else { diff --git a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php index 36d4dbbb8fd..b56100b6be9 100644 --- a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php +++ b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php @@ -60,7 +60,7 @@ class RemoteShares extends Base { if ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_ACCEPTED) { $subject = $this->l->t('{user} accepted the remote share'); - } else if ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_DECLINED) { + } elseif ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_DECLINED) { $subject = $this->l->t('{user} declined the remote share'); } else { throw new \InvalidArgumentException(); @@ -87,11 +87,11 @@ class RemoteShares extends Base { if ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_RECEIVED) { $subject = $this->l->t('You received a new remote share {file} from {user}'); - } else if ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_ACCEPTED) { + } elseif ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_ACCEPTED) { $subject = $this->l->t('{user} accepted the remote share of {file}'); - } else if ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_DECLINED) { + } elseif ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_DECLINED) { $subject = $this->l->t('{user} declined the remote share of {file}'); - } else if ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_UNSHARED) { + } elseif ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_UNSHARED) { $subject = $this->l->t('{user} unshared {file} from you'); } else { throw new \InvalidArgumentException(); diff --git a/apps/files_sharing/lib/Activity/Providers/Users.php b/apps/files_sharing/lib/Activity/Providers/Users.php index 82c1cca9f8c..4274e551899 100644 --- a/apps/files_sharing/lib/Activity/Providers/Users.php +++ b/apps/files_sharing/lib/Activity/Providers/Users.php @@ -54,23 +54,23 @@ class Users extends Base { if ($event->getSubject() === self::SUBJECT_SHARED_USER_SELF) { $subject = $this->l->t('Shared with {user}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_USER_SELF) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_USER_SELF) { $subject = $this->l->t('Removed share for {user}'); - } else if ($event->getSubject() === self::SUBJECT_SELF_UNSHARED) { + } elseif ($event->getSubject() === self::SUBJECT_SELF_UNSHARED) { $subject = $this->l->t('You removed yourself'); - } else if ($event->getSubject() === self::SUBJECT_SELF_UNSHARED_BY) { + } elseif ($event->getSubject() === self::SUBJECT_SELF_UNSHARED_BY) { $subject = $this->l->t('{actor} removed themselves'); - } else if ($event->getSubject() === self::SUBJECT_RESHARED_USER_BY) { + } elseif ($event->getSubject() === self::SUBJECT_RESHARED_USER_BY) { $subject = $this->l->t('{actor} shared with {user}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_USER_BY) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_USER_BY) { $subject = $this->l->t('{actor} removed share for {user}'); - } else if ($event->getSubject() === self::SUBJECT_SHARED_WITH_BY) { + } elseif ($event->getSubject() === self::SUBJECT_SHARED_WITH_BY) { $subject = $this->l->t('Shared by {actor}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_BY) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_BY) { $subject = $this->l->t('{actor} removed share'); - } else if ($event->getSubject() === self::SUBJECT_EXPIRED_USER) { + } elseif ($event->getSubject() === self::SUBJECT_EXPIRED_USER) { $subject = $this->l->t('Share for {user} expired'); - } else if ($event->getSubject() === self::SUBJECT_EXPIRED) { + } elseif ($event->getSubject() === self::SUBJECT_EXPIRED) { $subject = $this->l->t('Share expired'); } else { throw new \InvalidArgumentException(); @@ -97,23 +97,23 @@ class Users extends Base { if ($event->getSubject() === self::SUBJECT_SHARED_USER_SELF) { $subject = $this->l->t('You shared {file} with {user}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_USER_SELF) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_USER_SELF) { $subject = $this->l->t('You removed {user} from {file}'); - } else if ($event->getSubject() === self::SUBJECT_SELF_UNSHARED) { + } elseif ($event->getSubject() === self::SUBJECT_SELF_UNSHARED) { $subject = $this->l->t('You removed yourself from {file}'); - } else if ($event->getSubject() === self::SUBJECT_SELF_UNSHARED_BY) { + } elseif ($event->getSubject() === self::SUBJECT_SELF_UNSHARED_BY) { $subject = $this->l->t('{actor} removed themselves from {file}'); - } else if ($event->getSubject() === self::SUBJECT_RESHARED_USER_BY) { + } elseif ($event->getSubject() === self::SUBJECT_RESHARED_USER_BY) { $subject = $this->l->t('{actor} shared {file} with {user}'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_USER_BY) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_USER_BY) { $subject = $this->l->t('{actor} removed {user} from {file}'); - } else if ($event->getSubject() === self::SUBJECT_SHARED_WITH_BY) { + } elseif ($event->getSubject() === self::SUBJECT_SHARED_WITH_BY) { $subject = $this->l->t('{actor} shared {file} with you'); - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_BY) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_BY) { $subject = $this->l->t('{actor} removed you from the share named {file}'); - } else if ($event->getSubject() === self::SUBJECT_EXPIRED_USER) { + } elseif ($event->getSubject() === self::SUBJECT_EXPIRED_USER) { $subject = $this->l->t('Share for file {file} with {user} expired'); - } else if ($event->getSubject() === self::SUBJECT_EXPIRED) { + } elseif ($event->getSubject() === self::SUBJECT_EXPIRED) { $subject = $this->l->t('Share for file {file} expired'); } else { diff --git a/apps/files_sharing/lib/Controller/DeletedShareAPIController.php b/apps/files_sharing/lib/Controller/DeletedShareAPIController.php index b109a6282fa..fc58b5d1209 100644 --- a/apps/files_sharing/lib/Controller/DeletedShareAPIController.php +++ b/apps/files_sharing/lib/Controller/DeletedShareAPIController.php @@ -143,7 +143,7 @@ class DeletedShareAPIController extends OCSController { $group = $this->groupManager->get($share->getSharedWith()); $result['share_with'] = $share->getSharedWith(); $result['share_with_displayname'] = $group !== null ? $group->getDisplayName() : $share->getSharedWith(); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_ROOM) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_ROOM) { $result['share_with'] = $share->getSharedWith(); $result['share_with_displayname'] = ''; diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 833bc788687..40a9a387dde 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -218,11 +218,11 @@ class ShareAPIController extends OCSController { $sharedWith = $this->userManager->get($share->getSharedWith()); $result['share_with'] = $share->getSharedWith(); $result['share_with_displayname'] = $sharedWith !== null ? $sharedWith->getDisplayName() : $share->getSharedWith(); - } else if ($share->getShareType() === Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === Share::SHARE_TYPE_GROUP) { $group = $this->groupManager->get($share->getSharedWith()); $result['share_with'] = $share->getSharedWith(); $result['share_with_displayname'] = $group !== null ? $group->getDisplayName() : $share->getSharedWith(); - } else if ($share->getShareType() === IShare::TYPE_LINK) { + } elseif ($share->getShareType() === IShare::TYPE_LINK) { // "share_with" and "share_with_displayname" for passwords of link // shares was deprecated in Nextcloud 15, use "password" instead. @@ -235,17 +235,17 @@ class ShareAPIController extends OCSController { $result['token'] = $share->getToken(); $result['url'] = $this->urlGenerator->linkToRouteAbsolute('files_sharing.sharecontroller.showShare', ['token' => $share->getToken()]); - } else if ($share->getShareType() === Share::SHARE_TYPE_REMOTE || $share->getShareType() === Share::SHARE_TYPE_REMOTE_GROUP) { + } elseif ($share->getShareType() === Share::SHARE_TYPE_REMOTE || $share->getShareType() === Share::SHARE_TYPE_REMOTE_GROUP) { $result['share_with'] = $share->getSharedWith(); $result['share_with_displayname'] = $this->getDisplayNameFromAddressBook($share->getSharedWith(), 'CLOUD'); $result['token'] = $share->getToken(); - } else if ($share->getShareType() === Share::SHARE_TYPE_EMAIL) { + } elseif ($share->getShareType() === Share::SHARE_TYPE_EMAIL) { $result['share_with'] = $share->getSharedWith(); $result['password'] = $share->getPassword(); $result['send_password_by_talk'] = $share->getSendPasswordByTalk(); $result['share_with_displayname'] = $this->getDisplayNameFromAddressBook($share->getSharedWith(), 'EMAIL'); $result['token'] = $share->getToken(); - } else if ($share->getShareType() === Share::SHARE_TYPE_CIRCLE) { + } elseif ($share->getShareType() === Share::SHARE_TYPE_CIRCLE) { // getSharedWith() returns either "name (type, owner)" or // "name (type, owner) [id]", depending on the Circles app version. $hasCircleId = (substr($share->getSharedWith(), -1) === ']'); @@ -264,7 +264,7 @@ class ShareAPIController extends OCSController { $shareWithLength = -1; } $result['share_with'] = substr($share->getSharedWith(), $shareWithStart, $shareWithLength); - } else if ($share->getShareType() === Share::SHARE_TYPE_ROOM) { + } elseif ($share->getShareType() === Share::SHARE_TYPE_ROOM) { $result['share_with'] = $share->getSharedWith(); $result['share_with_displayname'] = ''; @@ -461,7 +461,7 @@ class ShareAPIController extends OCSController { } $share->setSharedWith($shareWith); $share->setPermissions($permissions); - } else if ($shareType === Share::SHARE_TYPE_GROUP) { + } elseif ($shareType === Share::SHARE_TYPE_GROUP) { if (!$this->shareManager->allowGroupSharing()) { throw new OCSNotFoundException($this->l->t('Group sharing is disabled by the administrator')); } @@ -472,7 +472,7 @@ class ShareAPIController extends OCSController { } $share->setSharedWith($shareWith); $share->setPermissions($permissions); - } else if ($shareType === Share::SHARE_TYPE_LINK + } elseif ($shareType === Share::SHARE_TYPE_LINK || $shareType === Share::SHARE_TYPE_EMAIL) { // Can we even share links? @@ -533,21 +533,21 @@ class ShareAPIController extends OCSController { throw new OCSNotFoundException($this->l->t('Invalid date, date format must be YYYY-MM-DD')); } } - } else if ($shareType === Share::SHARE_TYPE_REMOTE) { + } elseif ($shareType === Share::SHARE_TYPE_REMOTE) { if (!$this->shareManager->outgoingServer2ServerSharesAllowed()) { throw new OCSForbiddenException($this->l->t('Sharing %1$s failed because the back end does not allow shares from type %2$s', [$path->getPath(), $shareType])); } $share->setSharedWith($shareWith); $share->setPermissions($permissions); - } else if ($shareType === Share::SHARE_TYPE_REMOTE_GROUP) { + } elseif ($shareType === Share::SHARE_TYPE_REMOTE_GROUP) { if (!$this->shareManager->outgoingServer2ServerGroupSharesAllowed()) { throw new OCSForbiddenException($this->l->t('Sharing %1$s failed because the back end does not allow shares from type %2$s', [$path->getPath(), $shareType])); } $share->setSharedWith($shareWith); $share->setPermissions($permissions); - } else if ($shareType === Share::SHARE_TYPE_CIRCLE) { + } elseif ($shareType === Share::SHARE_TYPE_CIRCLE) { if (!\OC::$server->getAppManager()->isEnabledForUser('circles') || !class_exists('\OCA\Circles\ShareByCircleProvider')) { throw new OCSNotFoundException($this->l->t('You cannot share to a Circle if the app is not enabled')); } @@ -560,7 +560,7 @@ class ShareAPIController extends OCSController { } $share->setSharedWith($shareWith); $share->setPermissions($permissions); - } else if ($shareType === Share::SHARE_TYPE_ROOM) { + } elseif ($shareType === Share::SHARE_TYPE_ROOM) { try { $this->getRoomShareHelper()->createShare($share, $shareWith, $permissions, $expireDate); } catch (QueryException $e) { @@ -975,14 +975,14 @@ class ShareAPIController extends OCSController { // Update hide download state if ($hideDownload === 'true') { $share->setHideDownload(true); - } else if ($hideDownload === 'false') { + } elseif ($hideDownload === 'false') { $share->setHideDownload(false); } $newPermissions = null; if ($publicUpload === 'true') { $newPermissions = Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE; - } else if ($publicUpload === 'false') { + } elseif ($publicUpload === 'false') { $newPermissions = Constants::PERMISSION_READ; } @@ -1028,7 +1028,7 @@ class ShareAPIController extends OCSController { if ($expireDate === '') { $share->setExpirationDate(null); - } else if ($expireDate !== null) { + } elseif ($expireDate !== null) { try { $expireDate = $this->parseDate($expireDate); } catch (\Exception $e) { @@ -1039,7 +1039,7 @@ class ShareAPIController extends OCSController { if ($password === '') { $share->setPassword(null); - } else if ($password !== null) { + } elseif ($password !== null) { $share->setPassword($password); } @@ -1054,7 +1054,7 @@ class ShareAPIController extends OCSController { } $share->setSendPasswordByTalk(true); - } else if ($sendPasswordByTalk !== null) { + } elseif ($sendPasswordByTalk !== null) { $share->setSendPasswordByTalk(false); } } @@ -1068,7 +1068,7 @@ class ShareAPIController extends OCSController { if ($expireDate === '') { $share->setExpirationDate(null); - } else if ($expireDate !== null) { + } elseif ($expireDate !== null) { try { $expireDate = $this->parseDate($expireDate); } catch (\Exception $e) { diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php index 898e57c1591..a8cd2196629 100644 --- a/apps/files_sharing/lib/Controller/ShareesAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php @@ -193,7 +193,7 @@ class ShareesAPIController extends OCSController { if ($shareType !== null && is_array($shareType)) { $shareTypes = array_intersect($shareTypes, $shareType); - } else if (is_numeric($shareType)) { + } elseif (is_numeric($shareType)) { $shareTypes = array_intersect($shareTypes, [(int) $shareType]); } sort($shareTypes); @@ -362,7 +362,7 @@ class ShareesAPIController extends OCSController { if (isset($_GET['shareType']) && is_array($_GET['shareType'])) { $shareTypes = array_intersect($shareTypes, $_GET['shareType']); sort($shareTypes); - } else if (is_numeric($shareType)) { + } elseif (is_numeric($shareType)) { $shareTypes = array_intersect($shareTypes, [(int) $shareType]); sort($shareTypes); } diff --git a/apps/files_sharing/lib/External/Manager.php b/apps/files_sharing/lib/External/Manager.php index 31cc7135c0e..ee547ce9114 100644 --- a/apps/files_sharing/lib/External/Manager.php +++ b/apps/files_sharing/lib/External/Manager.php @@ -250,7 +250,7 @@ class Manager { // check if the user is allowed to access it if ($validShare && (int)$share['share_type'] === Share::SHARE_TYPE_USER && $share['user'] === $this->uid) { return $share; - } else if ($validShare && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { + } elseif ($validShare && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { $user = $this->userManager->get($this->uid); if ($this->groupManager->get($share['user'])->inGroup($user)) { return $share; @@ -333,7 +333,7 @@ class Manager { $this->processNotification($id); $result = true; - } else if ($share && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { + } elseif ($share && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { $result = $this->writeShareToDb( $share['remote'], $share['share_token'], @@ -537,7 +537,7 @@ class Manager { WHERE `id` = ? '); $result = (bool)$query->execute([(int)$share['id']]); - } else if ($result && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { + } elseif ($result && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { $query = $this->connection->prepare(' UPDATE `*PREFIX*share_external` SET `accepted` = ? diff --git a/apps/files_sharing/lib/External/Storage.php b/apps/files_sharing/lib/External/Storage.php index 95008574627..1390c0a4f56 100644 --- a/apps/files_sharing/lib/External/Storage.php +++ b/apps/files_sharing/lib/External/Storage.php @@ -361,7 +361,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage { // old federated sharing permissions if (isset($response['{http://open-collaboration-services.org/ns}share-permissions'])) { $permissions = $response['{http://open-collaboration-services.org/ns}share-permissions']; - } else if (isset($response['{http://open-cloud-mesh.org/ns}share-permissions'])) { + } elseif (isset($response['{http://open-cloud-mesh.org/ns}share-permissions'])) { // permissions provided by the OCM API $permissions = $this->ocmPermissions2ncPermissions($response['{http://open-collaboration-services.org/ns}share-permissions']); } else { diff --git a/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php b/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php index 010fdd9f883..758138bb7f0 100644 --- a/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php +++ b/apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php @@ -60,7 +60,7 @@ class UserShareAcceptanceListener implements IEventListener { if ($share->getShareType() === IShare::TYPE_USER) { $this->handleAutoAccept($share, $share->getSharedWith()); - } else if ($share->getShareType() === IShare::TYPE_GROUP) { + } elseif ($share->getShareType() === IShare::TYPE_GROUP) { $group = $this->groupManager->get($share->getSharedWith()); if ($group === null) { diff --git a/apps/files_sharing/lib/Notification/Listener.php b/apps/files_sharing/lib/Notification/Listener.php index 8f5dccdd20f..1b2678b2bc3 100644 --- a/apps/files_sharing/lib/Notification/Listener.php +++ b/apps/files_sharing/lib/Notification/Listener.php @@ -66,7 +66,7 @@ class Listener { $notification->setSubject(Notifier::INCOMING_USER_SHARE) ->setUser($share->getSharedWith()); $this->notificationManager->notify($notification); - } else if ($share->getShareType() === IShare::TYPE_GROUP) { + } elseif ($share->getShareType() === IShare::TYPE_GROUP) { $notification->setSubject(Notifier::INCOMING_GROUP_SHARE); $group = $this->groupManager->get($share->getSharedWith()); diff --git a/apps/files_sharing/lib/Notification/Notifier.php b/apps/files_sharing/lib/Notification/Notifier.php index a47b04e5b14..07c41882917 100644 --- a/apps/files_sharing/lib/Notification/Notifier.php +++ b/apps/files_sharing/lib/Notification/Notifier.php @@ -154,7 +154,7 @@ class Notifier implements INotifier { if ($share->getStatus() !== IShare::STATUS_PENDING) { throw new AlreadyProcessedException(); } - } else if ($share->getShareType() === IShare::TYPE_GROUP) { + } elseif ($share->getShareType() === IShare::TYPE_GROUP) { if ($share->getStatus() !== IShare::STATUS_PENDING) { throw new AlreadyProcessedException(); } diff --git a/apps/files_sharing/lib/ShareBackend/File.php b/apps/files_sharing/lib/ShareBackend/File.php index f811d7f6bd4..fdbd0da96a3 100644 --- a/apps/files_sharing/lib/ShareBackend/File.php +++ b/apps/files_sharing/lib/ShareBackend/File.php @@ -134,7 +134,7 @@ class File implements \OCP\Share_Backend_File_Dependent { 'permissions' => $item['permissions'], 'uid_owner' => $item['uid_owner'], ]; - } else if ($format === self::FORMAT_GET_FOLDER_CONTENTS) { + } elseif ($format === self::FORMAT_GET_FOLDER_CONTENTS) { $files = []; foreach ($items as $item) { $file = []; @@ -157,25 +157,25 @@ class File implements \OCP\Share_Backend_File_Dependent { $files[] = $file; } return $files; - } else if ($format === self::FORMAT_OPENDIR) { + } elseif ($format === self::FORMAT_OPENDIR) { $files = []; foreach ($items as $item) { $files[] = basename($item['file_target']); } return $files; - } else if ($format === self::FORMAT_GET_ALL) { + } elseif ($format === self::FORMAT_GET_ALL) { $ids = []; foreach ($items as $item) { $ids[] = $item['file_source']; } return $ids; - } else if ($format === self::FORMAT_PERMISSIONS) { + } elseif ($format === self::FORMAT_PERMISSIONS) { $filePermissions = []; foreach ($items as $item) { $filePermissions[$item['file_source']] = $item['permissions']; } return $filePermissions; - } else if ($format === self::FORMAT_TARGET_NAMES) { + } elseif ($format === self::FORMAT_TARGET_NAMES) { $targets = []; foreach ($items as $item) { $targets[] = $item['file_target']; diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php index cda01aacba2..f3fe96d2c3d 100644 --- a/apps/files_sharing/tests/SharedMountTest.php +++ b/apps/files_sharing/tests/SharedMountTest.php @@ -334,7 +334,7 @@ class SharedMountTest extends TestCase { if ($type === 'file') { $path = $this->filename; - } else if ($type === 'folder') { + } elseif ($type === 'folder') { $path = $this->folder; } diff --git a/apps/files_trashbin/lib/Helper.php b/apps/files_trashbin/lib/Helper.php index 8f292ac33cd..2e47abbae7b 100644 --- a/apps/files_trashbin/lib/Helper.php +++ b/apps/files_trashbin/lib/Helper.php @@ -71,7 +71,7 @@ class Helper { $timestamp = substr($pathparts['extension'], 1); $name = $pathparts['filename']; - } else if ($timestamp === null) { + } elseif ($timestamp === null) { // for subfolders we need to calculate the timestamp only once $parts = explode('/', ltrim($dir, '/')); $timestamp = substr(pathinfo($parts[0], PATHINFO_EXTENSION), 1); diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 24d49a4c8c5..a308ec78532 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -325,7 +325,7 @@ class Trashbin { self::copy_recursive($owner . '/files_versions/' . $ownerPath, $owner . '/files_trashbin/versions/' . basename($ownerPath) . '.d' . $timestamp, $rootView); } self::move($rootView, $owner . '/files_versions/' . $ownerPath, $user . '/files_trashbin/versions/' . $filename . '.d' . $timestamp); - } else if ($versions = \OCA\Files_Versions\Storage::getVersions($owner, $ownerPath)) { + } elseif ($versions = \OCA\Files_Versions\Storage::getVersions($owner, $ownerPath)) { foreach ($versions as $v) { if ($owner !== $user) { @@ -484,7 +484,7 @@ class Trashbin { if ($view->is_dir('/files_trashbin/versions/' . $file)) { $rootView->rename(Filesystem::normalizePath($user . '/files_trashbin/versions/' . $file), Filesystem::normalizePath($owner . '/files_versions/' . $ownerPath)); - } else if ($versions = self::getVersionsFromTrash($versionedFile, $timestamp, $user)) { + } elseif ($versions = self::getVersionsFromTrash($versionedFile, $timestamp, $user)) { foreach ($versions as $v) { if ($timestamp) { $rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v . '.d' . $timestamp, $owner . '/files_versions/' . $ownerPath . '.v' . $v); @@ -593,7 +593,7 @@ class Trashbin { if ($node instanceof Folder) { $size += self::calculateSize(new View('/' . $user . '/files_trashbin/files/' . $file)); - } else if ($node instanceof File) { + } elseif ($node instanceof File) { $size += $view->filesize('/files_trashbin/files/' . $file); } @@ -618,7 +618,7 @@ class Trashbin { if ($view->is_dir('files_trashbin/versions/' . $file)) { $size += self::calculateSize(new View('/' . $user . '/files_trashbin/versions/' . $file)); $view->unlink('files_trashbin/versions/' . $file); - } else if ($versions = self::getVersionsFromTrash($filename, $timestamp, $user)) { + } elseif ($versions = self::getVersionsFromTrash($filename, $timestamp, $user)) { foreach ($versions as $v) { if ($timestamp) { $size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp); diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index 8150089c078..a149e352e3d 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -301,7 +301,7 @@ class Storage { '/' . $targetOwner . '/files_versions/' . $targetPath ); } - } else if ($versions = Storage::getVersions($sourceOwner, '/' . $sourcePath)) { + } elseif ($versions = Storage::getVersions($sourceOwner, '/' . $sourcePath)) { // create missing dirs if necessary self::createMissingDirectories($targetPath, new View('/'. $targetOwner)); @@ -384,7 +384,7 @@ class Storage { 'node' => $node, ]); return true; - } else if ($versionCreated) { + } elseif ($versionCreated) { self::deleteVersion($users_view, $version); } diff --git a/apps/provisioning_api/lib/Controller/GroupsController.php b/apps/provisioning_api/lib/Controller/GroupsController.php index aa774506853..435f0410217 100644 --- a/apps/provisioning_api/lib/Controller/GroupsController.php +++ b/apps/provisioning_api/lib/Controller/GroupsController.php @@ -285,7 +285,7 @@ class GroupsController extends AUserData { // Check it exists if(!$this->groupManager->groupExists($groupId)){ throw new OCSException('', 101); - } else if($groupId === 'admin' || !$this->groupManager->get($groupId)->delete()){ + } elseif($groupId === 'admin' || !$this->groupManager->get($groupId)->delete()){ // Cannot delete admin group throw new OCSException('', 102); } diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index 6ed5a1217c5..ff67a880c13 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -142,7 +142,7 @@ class UsersController extends AUserData { $subAdminManager = $this->groupManager->getSubAdmin(); if ($this->groupManager->isAdmin($uid)){ $users = $this->userManager->search($search, $limit, $offset); - } else if ($subAdminManager->isSubAdmin($user)) { + } elseif ($subAdminManager->isSubAdmin($user)) { $subAdminOfGroups = $subAdminManager->getSubAdminsGroups($user); foreach ($subAdminOfGroups as $key => $group) { $subAdminOfGroups[$key] = $group->getGID(); @@ -176,7 +176,7 @@ class UsersController extends AUserData { if ($this->groupManager->isAdmin($uid)){ $users = $this->userManager->search($search, $limit, $offset); $users = array_keys($users); - } else if ($subAdminManager->isSubAdmin($currentUser)) { + } elseif ($subAdminManager->isSubAdmin($currentUser)) { $subAdminOfGroups = $subAdminManager->getSubAdminsGroups($currentUser); foreach ($subAdminOfGroups as $key => $group) { $subAdminOfGroups[$key] = $group->getGID(); @@ -836,7 +836,7 @@ class UsersController extends AUserData { throw new OCSException('Cannot remove yourself from this group as you are a SubAdmin', 105); } - } else if (!$this->groupManager->isAdmin($loggedInUser->getUID())) { + } elseif (!$this->groupManager->isAdmin($loggedInUser->getUID())) { /** @var IGroup[] $subAdminGroups */ $subAdminGroups = $subAdminManager->getSubAdminsGroups($loggedInUser); $subAdminGroups = array_map(function (IGroup $subAdminGroup) { diff --git a/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php b/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php index eb5ed1900b7..a87f69a25b3 100644 --- a/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php +++ b/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php @@ -214,7 +214,7 @@ class AppConfigControllerTest extends TestCase { ->method('verifyConfigKey'); $this->config->expects($this->never()) ->method('setAppValue'); - } else if ($keyThrows instanceof \Exception) { + } elseif ($keyThrows instanceof \Exception) { $api->expects($this->once()) ->method('verifyAppId') ->with($app); @@ -243,7 +243,7 @@ class AppConfigControllerTest extends TestCase { $this->assertSame($status, $result->getStatus()); if ($appThrows instanceof \Exception) { $this->assertEquals(['data' => ['message' => $appThrows->getMessage()]], $result->getData()); - } else if ($keyThrows instanceof \Exception) { + } elseif ($keyThrows instanceof \Exception) { $this->assertEquals(['data' => ['message' => $keyThrows->getMessage()]], $result->getData()); } else { $this->assertEquals([], $result->getData()); @@ -279,7 +279,7 @@ class AppConfigControllerTest extends TestCase { ->method('verifyConfigKey'); $this->config->expects($this->never()) ->method('deleteAppValue'); - } else if ($keyThrows instanceof \Exception) { + } elseif ($keyThrows instanceof \Exception) { $api->expects($this->once()) ->method('verifyAppId') ->with($app); @@ -308,7 +308,7 @@ class AppConfigControllerTest extends TestCase { $this->assertSame($status, $result->getStatus()); if ($appThrows instanceof \Exception) { $this->assertEquals(['data' => ['message' => $appThrows->getMessage()]], $result->getData()); - } else if ($keyThrows instanceof \Exception) { + } elseif ($keyThrows instanceof \Exception) { $this->assertEquals(['data' => ['message' => $keyThrows->getMessage()]], $result->getData()); } else { $this->assertEquals([], $result->getData()); diff --git a/apps/settings/lib/Activity/GroupProvider.php b/apps/settings/lib/Activity/GroupProvider.php index 5ad2cce0325..65ca2627775 100644 --- a/apps/settings/lib/Activity/GroupProvider.php +++ b/apps/settings/lib/Activity/GroupProvider.php @@ -96,7 +96,7 @@ class GroupProvider implements IProvider { } else { $subject = $l->t('{actor} added {user} to group {group}'); } - } else if ($this->activityManager->getCurrentUserId() === $params['user']) { + } elseif ($this->activityManager->getCurrentUserId() === $params['user']) { $subject = $l->t('An administrator added you to group {group}'); } else { $subject = $l->t('An administrator added {user} to group {group}'); @@ -111,7 +111,7 @@ class GroupProvider implements IProvider { } else { $subject = $l->t('{actor} removed {user} from group {group}'); } - } else if ($this->activityManager->getCurrentUserId() === $params['user']) { + } elseif ($this->activityManager->getCurrentUserId() === $params['user']) { $subject = $l->t('An administrator removed you from group {group}'); } else { $subject = $l->t('An administrator removed {user} from group {group}'); diff --git a/apps/settings/lib/Activity/Provider.php b/apps/settings/lib/Activity/Provider.php index d21d7a9198a..ecf653eb0e4 100644 --- a/apps/settings/lib/Activity/Provider.php +++ b/apps/settings/lib/Activity/Provider.php @@ -102,27 +102,27 @@ class Provider implements IProvider { if ($event->getSubject() === self::PASSWORD_CHANGED_BY) { $subject = $this->l->t('{actor} changed your password'); - } else if ($event->getSubject() === self::PASSWORD_CHANGED_SELF) { + } elseif ($event->getSubject() === self::PASSWORD_CHANGED_SELF) { $subject = $this->l->t('You changed your password'); - } else if ($event->getSubject() === self::PASSWORD_RESET) { + } elseif ($event->getSubject() === self::PASSWORD_RESET) { $subject = $this->l->t('Your password was reset by an administrator'); - } else if ($event->getSubject() === self::EMAIL_CHANGED_BY) { + } elseif ($event->getSubject() === self::EMAIL_CHANGED_BY) { $subject = $this->l->t('{actor} changed your email address'); - } else if ($event->getSubject() === self::EMAIL_CHANGED_SELF) { + } elseif ($event->getSubject() === self::EMAIL_CHANGED_SELF) { $subject = $this->l->t('You changed your email address'); - } else if ($event->getSubject() === self::EMAIL_CHANGED) { + } elseif ($event->getSubject() === self::EMAIL_CHANGED) { $subject = $this->l->t('Your email address was changed by an administrator'); - } else if ($event->getSubject() === self::APP_TOKEN_CREATED) { + } elseif ($event->getSubject() === self::APP_TOKEN_CREATED) { $subject = $this->l->t('You created app password "{token}"'); - } else if ($event->getSubject() === self::APP_TOKEN_DELETED) { + } elseif ($event->getSubject() === self::APP_TOKEN_DELETED) { $subject = $this->l->t('You deleted app password "{token}"'); - } else if ($event->getSubject() === self::APP_TOKEN_RENAMED) { + } elseif ($event->getSubject() === self::APP_TOKEN_RENAMED) { $subject = $this->l->t('You renamed app password "{token}" to "{newToken}"'); - } else if ($event->getSubject() === self::APP_TOKEN_FILESYSTEM_GRANTED) { + } elseif ($event->getSubject() === self::APP_TOKEN_FILESYSTEM_GRANTED) { $subject = $this->l->t('You granted filesystem access to app password "{token}"'); - } else if ($event->getSubject() === self::APP_TOKEN_FILESYSTEM_REVOKED) { + } elseif ($event->getSubject() === self::APP_TOKEN_FILESYSTEM_REVOKED) { $subject = $this->l->t('You revoked filesystem access from app password "{token}"'); } else { diff --git a/apps/settings/lib/Controller/CommonSettingsTrait.php b/apps/settings/lib/Controller/CommonSettingsTrait.php index da102d2ed20..7aa202429eb 100644 --- a/apps/settings/lib/Controller/CommonSettingsTrait.php +++ b/apps/settings/lib/Controller/CommonSettingsTrait.php @@ -89,7 +89,7 @@ trait CommonSettingsTrait { foreach ($prioritizedSections as $section) { if($type === 'admin') { $settings = $this->settingsManager->getAdminSettings($section->getID(), $subAdminOnly); - } else if($type === 'personal') { + } elseif($type === 'personal') { $settings = $this->settingsManager->getPersonalSettings($section->getID()); } if (empty($settings) && !($section->getID() === 'additional' && count(\OC_App::getForms('admin')) > 0)) { diff --git a/apps/settings/templates/settings/admin/server.php b/apps/settings/templates/settings/admin/server.php index 513e82ece5a..bde4423f67f 100644 --- a/apps/settings/templates/settings/admin/server.php +++ b/apps/settings/templates/settings/admin/server.php @@ -41,7 +41,7 @@ <span class="crondate" title="<?php p($absolute_time);?>"> <?php p($l->t("Last job execution ran %s. Something seems wrong.", [$relative_time]));?> </span> - <?php } else if (time() - $_['cronMaxAge'] > 12*3600) { + <?php } elseif (time() - $_['cronMaxAge'] > 12*3600) { if ($_['backgroundjobs_mode'] === 'cron') { ?> <span class="status warning"></span> <span class="crondate" title="<?php p($maxAgeAbsoluteTime);?>"> diff --git a/apps/settings/templates/settings/empty.php b/apps/settings/templates/settings/empty.php index e8999f5f07e..63ebc6f44a1 100644 --- a/apps/settings/templates/settings/empty.php +++ b/apps/settings/templates/settings/empty.php @@ -21,4 +21,4 @@ * */ - # used for Personal/Additional settings as fallback for legacy settings
\ No newline at end of file + # used for Personal/Additional settings as fallback for legacy settings diff --git a/apps/sharebymail/lib/Activity.php b/apps/sharebymail/lib/Activity.php index a588ee3b6ca..279055538d9 100644 --- a/apps/sharebymail/lib/Activity.php +++ b/apps/sharebymail/lib/Activity.php @@ -129,7 +129,7 @@ class Activity implements IProvider { } else { $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); } - } else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_BY) { + } elseif ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_BY) { $event->setParsedSubject($this->l->t('Shared with %1$s by %2$s', [ $parsedParameters['email']['name'], $parsedParameters['actor']['name'], @@ -143,7 +143,7 @@ class Activity implements IProvider { } else { $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); } - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_EMAIL_SELF) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_EMAIL_SELF) { $event->setParsedSubject($this->l->t('Unshared from %1$s', [ $parsedParameters['email']['name'], ])) @@ -155,7 +155,7 @@ class Activity implements IProvider { } else { $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); } - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_EMAIL_BY) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_EMAIL_BY) { $event->setParsedSubject($this->l->t('Unshared from %1$s by %2$s', [ $parsedParameters['email']['name'], $parsedParameters['actor']['name'], @@ -169,7 +169,7 @@ class Activity implements IProvider { } else { $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); } - } else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND) { + } elseif ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND) { $event->setParsedSubject($this->l->t('Password for mail share sent to %1$s', [ $parsedParameters['email']['name'] ])) @@ -181,7 +181,7 @@ class Activity implements IProvider { } else { $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); } - } else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF) { + } elseif ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF) { $event->setParsedSubject($this->l->t('Password for mail share sent to you')) ->setRichSubject($this->l->t('Password for mail share sent to you')); if ($this->activityManager->getRequirePNG()) { @@ -216,7 +216,7 @@ class Activity implements IProvider { } else { $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); } - } else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_BY) { + } elseif ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_BY) { $event->setParsedSubject($this->l->t('%3$s shared %1$s with %2$s by mail', [ $parsedParameters['file']['path'], $parsedParameters['email']['name'], @@ -228,7 +228,7 @@ class Activity implements IProvider { } else { $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); } - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_EMAIL_SELF) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_EMAIL_SELF) { $event->setParsedSubject($this->l->t('You unshared %1$s from %2$s by mail', [ $parsedParameters['file']['path'], $parsedParameters['email']['name'], @@ -239,7 +239,7 @@ class Activity implements IProvider { } else { $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); } - } else if ($event->getSubject() === self::SUBJECT_UNSHARED_EMAIL_BY) { + } elseif ($event->getSubject() === self::SUBJECT_UNSHARED_EMAIL_BY) { $event->setParsedSubject($this->l->t('%3$s unshared %1$s from %2$s by mail', [ $parsedParameters['file']['path'], $parsedParameters['email']['name'], @@ -251,7 +251,7 @@ class Activity implements IProvider { } else { $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); } - } else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND) { + } elseif ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND) { $event->setParsedSubject($this->l->t('Password to access %1$s was sent to %2s', [ $parsedParameters['file']['path'], $parsedParameters['email']['name'] @@ -262,7 +262,7 @@ class Activity implements IProvider { } else { $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg'))); } - } else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF) { + } elseif ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF) { $event->setParsedSubject( $this->l->t('Password to access %1$s was sent to you', [$parsedParameters['file']['path']])) diff --git a/apps/systemtags/lib/Activity/Listener.php b/apps/systemtags/lib/Activity/Listener.php index e8bd53001e6..00568ab837e 100644 --- a/apps/systemtags/lib/Activity/Listener.php +++ b/apps/systemtags/lib/Activity/Listener.php @@ -117,13 +117,13 @@ class Listener { $actor, $this->prepareTagAsParameter($event->getTag()), ]); - } else if ($event->getEvent() === ManagerEvent::EVENT_UPDATE) { + } elseif ($event->getEvent() === ManagerEvent::EVENT_UPDATE) { $activity->setSubject(Provider::UPDATE_TAG, [ $actor, $this->prepareTagAsParameter($event->getTag()), $this->prepareTagAsParameter($event->getTagBefore()), ]); - } else if ($event->getEvent() === ManagerEvent::EVENT_DELETE) { + } elseif ($event->getEvent() === ManagerEvent::EVENT_DELETE) { $activity->setSubject(Provider::DELETE_TAG, [ $actor, $this->prepareTagAsParameter($event->getTag()), @@ -217,7 +217,7 @@ class Listener { $path, $this->prepareTagAsParameter($tag), ]); - } else if ($event->getEvent() === MapperEvent::EVENT_UNASSIGN) { + } elseif ($event->getEvent() === MapperEvent::EVENT_UNASSIGN) { $activity->setSubject(Provider::UNASSIGN_TAG, [ $actor, $path, diff --git a/apps/systemtags/lib/Activity/Provider.php b/apps/systemtags/lib/Activity/Provider.php index 862846a712a..459ab03bd1d 100644 --- a/apps/systemtags/lib/Activity/Provider.php +++ b/apps/systemtags/lib/Activity/Provider.php @@ -121,7 +121,7 @@ class Provider implements IProvider { ->setRichSubject($this->l->t('Added system tag {systemtag}'), [ 'systemtag' => $parsedParameters['systemtag'], ]); - } else if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) { + } elseif ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) { $event->setParsedSubject($this->l->t('Added system tag %1$s', [ $this->generatePlainSystemTag($parsedParameters['systemtag']), ])) @@ -138,7 +138,7 @@ class Provider implements IProvider { 'systemtag' => $parsedParameters['systemtag'], ]); } - } else if ($event->getSubject() === self::UNASSIGN_TAG) { + } elseif ($event->getSubject() === self::UNASSIGN_TAG) { if ($parsedParameters['actor']['id'] === '') { $event->setParsedSubject($this->l->t('System tag %1$s removed by the system', [ $this->generatePlainSystemTag($parsedParameters['systemtag']), @@ -146,7 +146,7 @@ class Provider implements IProvider { ->setRichSubject($this->l->t('Removed system tag {systemtag}'), [ 'systemtag' => $parsedParameters['systemtag'], ]); - } else if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) { + } elseif ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) { $event->setParsedSubject($this->l->t('Removed system tag %1$s', [ $this->generatePlainSystemTag($parsedParameters['systemtag']), ])) @@ -198,7 +198,7 @@ class Provider implements IProvider { ])) ->setRichSubject($this->l->t('{actor} created system tag {systemtag}'), $parsedParameters); } - } else if ($event->getSubject() === self::DELETE_TAG) { + } elseif ($event->getSubject() === self::DELETE_TAG) { if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) { $event->setParsedSubject($this->l->t('You deleted system tag %1$s', [ $this->generatePlainSystemTag($parsedParameters['systemtag']), @@ -211,7 +211,7 @@ class Provider implements IProvider { ])) ->setRichSubject($this->l->t('{actor} deleted system tag {systemtag}'), $parsedParameters); } - } else if ($event->getSubject() === self::UPDATE_TAG) { + } elseif ($event->getSubject() === self::UPDATE_TAG) { if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) { $event->setParsedSubject($this->l->t('You updated system tag %2$s to %1$s', [ $this->generatePlainSystemTag($parsedParameters['newsystemtag']), @@ -226,7 +226,7 @@ class Provider implements IProvider { ])) ->setRichSubject($this->l->t('{actor} updated system tag {oldsystemtag} to {newsystemtag}'), $parsedParameters); } - } else if ($event->getSubject() === self::ASSIGN_TAG) { + } elseif ($event->getSubject() === self::ASSIGN_TAG) { if ($parsedParameters['actor']['id'] === '') { unset($parsedParameters['actor']); $event->setParsedSubject($this->l->t('System tag %2$s was added to %1$s by the system', [ @@ -234,7 +234,7 @@ class Provider implements IProvider { $this->generatePlainSystemTag($parsedParameters['systemtag']), ])) ->setRichSubject($this->l->t('System tag {systemtag} was added to {file} by the system'), $parsedParameters); - } else if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) { + } elseif ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) { $event->setParsedSubject($this->l->t('You added system tag %2$s to %1$s', [ $parsedParameters['file']['path'], $this->generatePlainSystemTag($parsedParameters['systemtag']), @@ -248,7 +248,7 @@ class Provider implements IProvider { ])) ->setRichSubject($this->l->t('{actor} added system tag {systemtag} to {file}'), $parsedParameters); } - } else if ($event->getSubject() === self::UNASSIGN_TAG) { + } elseif ($event->getSubject() === self::UNASSIGN_TAG) { if ($parsedParameters['actor']['id'] === '') { unset($parsedParameters['actor']); $event->setParsedSubject($this->l->t('System tag %2$s was removed from %1$s by the system', [ @@ -256,7 +256,7 @@ class Provider implements IProvider { $this->generatePlainSystemTag($parsedParameters['systemtag']), ])) ->setRichSubject($this->l->t('System tag {systemtag} was removed from {file} by the system'), $parsedParameters); - } else if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) { + } elseif ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) { $event->setParsedSubject($this->l->t('You removed system tag %2$s from %1$s', [ $parsedParameters['file']['path'], $this->generatePlainSystemTag($parsedParameters['systemtag']), @@ -350,7 +350,7 @@ class Provider implements IProvider { protected function generatePlainSystemTag(array $parameter) { if ($parameter['assignable'] === '1') { return $parameter['name']; - } else if ($parameter['visibility'] === '1') { + } elseif ($parameter['visibility'] === '1') { return $this->l->t('%s (restricted)', $parameter['name']); } else { return $this->l->t('%s (invisible)', $parameter['name']); diff --git a/apps/testing/lib/Controller/LockingController.php b/apps/testing/lib/Controller/LockingController.php index 0c93ff68f82..b08c5e157c2 100644 --- a/apps/testing/lib/Controller/LockingController.php +++ b/apps/testing/lib/Controller/LockingController.php @@ -233,7 +233,7 @@ class LockingController extends OCSController { if ($type === ILockingProvider::LOCK_EXCLUSIVE && (int)$this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_EXCLUSIVE) { $lockingProvider->releaseLock($path, $this->config->getAppValue('testing', $lock)); - } else if ($type === ILockingProvider::LOCK_SHARED && (int)$this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_SHARED) { + } elseif ($type === ILockingProvider::LOCK_SHARED && (int)$this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_SHARED) { $lockingProvider->releaseLock($path, $this->config->getAppValue('testing', $lock)); } else { $lockingProvider->releaseLock($path, $this->config->getAppValue('testing', $lock)); diff --git a/apps/updatenotification/lib/Command/Check.php b/apps/updatenotification/lib/Command/Check.php index 93d3d19e60e..0062753d4a8 100644 --- a/apps/updatenotification/lib/Command/Check.php +++ b/apps/updatenotification/lib/Command/Check.php @@ -86,7 +86,7 @@ class Check extends Command { // Report summary if ($updatesAvailableCount === 0) { $output->writeln('<info>Everything up to date</info>'); - } else if ($updatesAvailableCount === 1) { + } elseif ($updatesAvailableCount === 1) { $output->writeln('<comment>1 update available</comment>'); } else { $output->writeln('<comment>' . $updatesAvailableCount . ' updates available</comment>'); diff --git a/apps/updatenotification/lib/Notification/BackgroundJob.php b/apps/updatenotification/lib/Notification/BackgroundJob.php index b2e3055f59a..d352375163f 100644 --- a/apps/updatenotification/lib/Notification/BackgroundJob.php +++ b/apps/updatenotification/lib/Notification/BackgroundJob.php @@ -107,7 +107,7 @@ class BackgroundJob extends TimedJob { if (\in_array($errors, $this->connectionNotifications, true)) { $this->sendErrorNotifications($errors); } - } else if (\is_array($status)) { + } elseif (\is_array($status)) { $this->config->setAppValue('updatenotification', 'update_check_errors', 0); $this->clearErrorNotifications(); diff --git a/apps/updatenotification/tests/Notification/BackgroundJobTest.php b/apps/updatenotification/tests/Notification/BackgroundJobTest.php index d52867e5c93..04b0260811e 100644 --- a/apps/updatenotification/tests/Notification/BackgroundJobTest.php +++ b/apps/updatenotification/tests/Notification/BackgroundJobTest.php @@ -178,7 +178,7 @@ class BackgroundJobTest extends TestCase { ->method('createNotifications'); $job->expects($versionCheck === null ? $this->never() : $this->once()) ->method('clearErrorNotifications'); - } else if ($version === false) { + } elseif ($version === false) { $job->expects($this->never()) ->method('createNotifications'); $job->expects($this->never()) diff --git a/apps/user_ldap/ajax/clearMappings.php b/apps/user_ldap/ajax/clearMappings.php index 63759662815..5102822ce4e 100644 --- a/apps/user_ldap/ajax/clearMappings.php +++ b/apps/user_ldap/ajax/clearMappings.php @@ -46,7 +46,7 @@ try { \OC::$server->getUserManager()->emit('\OC\User', 'postUnassignedUserId', [$uid]); } ); - } else if($subject === 'group') { + } elseif($subject === 'group') { $mapping = new GroupMapping(\OC::$server->getDatabaseConnection()); $result = $mapping->clear(); } diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index 836e1fddb85..5677f3614cc 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -729,7 +729,7 @@ class Access extends LDAPUtility { $sndName = isset($ldapObject[$sndAttribute][0]) ? $ldapObject[$sndAttribute][0] : ''; $this->cacheUserDisplayName($ncName, $nameByLDAP, $sndName); - } else if($nameByLDAP !== null) { + } elseif($nameByLDAP !== null) { $this->cacheGroupDisplayName($ncName, $nameByLDAP); } } @@ -1390,7 +1390,7 @@ class Access extends LDAPUtility { if($key !== 'dn') { if($this->resemblesDN($key)) { $selection[$i][$key] = $this->helper->sanitizeDN($item[$key]); - } else if($key === 'objectguid' || $key === 'guid') { + } elseif($key === 'objectguid' || $key === 'guid') { $selection[$i][$key] = [$this->convertObjectGUID2Str($item[$key][0])]; } else { $selection[$i][$key] = $item[$key]; @@ -1609,7 +1609,7 @@ class Access extends LDAPUtility { $result = $term; if ($term === '') { $result = '*'; - } else if ($allowEnum !== 'no') { + } elseif ($allowEnum !== 'no') { $result = $term . '*'; } return $result; @@ -1716,7 +1716,7 @@ class Access extends LDAPUtility { if(!$force) { if($this->connection->$uuidAttr !== 'auto') { return true; - } else if (is_string($uuidOverride) && trim($uuidOverride) !== '') { + } elseif (is_string($uuidOverride) && trim($uuidOverride) !== '') { $this->connection->$uuidAttr = $uuidOverride; return true; } @@ -2097,7 +2097,7 @@ class Access extends LDAPUtility { * So we added "&& !empty($this->lastCookie)" to this test to ignore pagination * if we don't have a previous paged search. */ - } else if ($limit === 0 && !empty($this->lastCookie)) { + } elseif ($limit === 0 && !empty($this->lastCookie)) { // a search without limit was requested. However, if we do use // Paged Search once, we always must do it. This requires us to // initialize it with the configured page size. diff --git a/apps/user_ldap/lib/Command/TestConfig.php b/apps/user_ldap/lib/Command/TestConfig.php index abab07d92f1..6ddd420e4f0 100644 --- a/apps/user_ldap/lib/Command/TestConfig.php +++ b/apps/user_ldap/lib/Command/TestConfig.php @@ -60,9 +60,9 @@ class TestConfig extends Command { $result = $this->testConfig($configID); if($result === 0) { $output->writeln('The configuration is valid and the connection could be established!'); - } else if($result === 1) { + } elseif($result === 1) { $output->writeln('The configuration is invalid. Please have a look at the logs for further details.'); - } else if($result === 2) { + } elseif($result === 2) { $output->writeln('The configuration is valid, but the Bind failed. Please check the server settings and credentials.'); } else { $output->writeln('Your LDAP server was kidnapped by aliens.'); diff --git a/apps/user_ldap/lib/Configuration.php b/apps/user_ldap/lib/Configuration.php index 3c6693b151e..ccba7b43586 100644 --- a/apps/user_ldap/lib/Configuration.php +++ b/apps/user_ldap/lib/Configuration.php @@ -318,7 +318,7 @@ class Configuration { protected function setMultiLine($varName, $value) { if(empty($value)) { $value = ''; - } else if (!is_array($value)) { + } elseif (!is_array($value)) { $value = preg_split('/\r\n|\r|\n|;/', $value); if($value === false) { $value = ''; diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index 14a0e19989a..51c35c2a665 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -202,7 +202,7 @@ class Connection extends LDAPUtility { public function getConnectionResource() { if(!$this->ldapConnectionRes) { $this->init(); - } else if(!$this->ldap->isResource($this->ldapConnectionRes)) { + } elseif(!$this->ldap->isResource($this->ldapConnectionRes)) { $this->ldapConnectionRes = null; $this->establishConnection(); } diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php index c166ad5ebef..246b61b5202 100644 --- a/apps/user_ldap/lib/Group_LDAP.php +++ b/apps/user_ldap/lib/Group_LDAP.php @@ -736,7 +736,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD || (strtolower($this->access->connection->ldapGroupMemberAssocAttr) === 'member') ) { $uid = $userDN; - } else if(strtolower($this->access->connection->ldapGroupMemberAssocAttr) === 'memberuid') { + } elseif(strtolower($this->access->connection->ldapGroupMemberAssocAttr) === 'memberuid') { $result = $this->access->readAttribute($userDN, 'uid'); if ($result === false) { \OCP\Util::writeLog('user_ldap', 'No uid attribute found for DN ' . $userDN . ' on '. diff --git a/apps/user_ldap/lib/Helper.php b/apps/user_ldap/lib/Helper.php index 595e3c92ec8..19797d8a98b 100644 --- a/apps/user_ldap/lib/Helper.php +++ b/apps/user_ldap/lib/Helper.php @@ -208,7 +208,7 @@ class Helper { $domain = false; if(isset($uinfo['host'])) { $domain = $uinfo['host']; - } else if(isset($uinfo['path'])) { + } elseif(isset($uinfo['path'])) { $domain = $uinfo['path']; } diff --git a/apps/user_ldap/lib/LDAP.php b/apps/user_ldap/lib/LDAP.php index f346272a18b..c4a30770566 100644 --- a/apps/user_ldap/lib/LDAP.php +++ b/apps/user_ldap/lib/LDAP.php @@ -343,19 +343,19 @@ class LDAP implements ILDAPWrapper { if($this->curFunc === 'ldap_get_entries' && $errorCode === -4) { - } else if ($errorCode === 32) { + } elseif ($errorCode === 32) { //for now - } else if ($errorCode === 10) { + } elseif ($errorCode === 10) { //referrals, we switch them off, but then there is AD :) - } else if ($errorCode === -1) { + } elseif ($errorCode === -1) { throw new ServerNotAvailableException('Lost connection to LDAP server.'); - } else if ($errorCode === 52) { + } elseif ($errorCode === 52) { throw new ServerNotAvailableException('LDAP server is shutting down.'); - } else if ($errorCode === 48) { + } elseif ($errorCode === 48) { throw new \Exception('LDAP authentication method rejected', $errorCode); - } else if ($errorCode === 1) { + } elseif ($errorCode === 1) { throw new \Exception('LDAP Operations error', $errorCode); - } else if ($errorCode === 19) { + } elseif ($errorCode === 19) { ldap_get_option($this->curArgs[0], LDAP_OPT_ERROR_STRING, $extended_error); throw new ConstraintViolationException(!empty($extended_error)?$extended_error:$errorMsg, $errorCode); } else { @@ -375,7 +375,7 @@ class LDAP implements ILDAPWrapper { private function postFunctionCall() { if($this->isResource($this->curArgs[0])) { $resource = $this->curArgs[0]; - } else if( + } elseif( $this->curFunc === 'ldap_search' && is_array($this->curArgs[0]) && $this->isResource($this->curArgs[0][0]) diff --git a/apps/user_ldap/lib/Notification/Notifier.php b/apps/user_ldap/lib/Notification/Notifier.php index 773242a635b..167f282beb7 100644 --- a/apps/user_ldap/lib/Notification/Notifier.php +++ b/apps/user_ldap/lib/Notification/Notifier.php @@ -83,7 +83,7 @@ class Notifier implements INotifier { $days = (int) $params[0]; if ($days === 2) { $notification->setParsedSubject($l->t('Your password will expire tomorrow.')); - } else if ($days === 1) { + } elseif ($days === 1) { $notification->setParsedSubject($l->t('Your password will expire today.')); } else { $notification->setParsedSubject($l->n( diff --git a/apps/user_ldap/lib/User/Manager.php b/apps/user_ldap/lib/User/Manager.php index c7660a40ba6..f3729f2458e 100644 --- a/apps/user_ldap/lib/User/Manager.php +++ b/apps/user_ldap/lib/User/Manager.php @@ -260,7 +260,7 @@ class Manager { $this->checkAccess(); if(isset($this->usersByDN[$id])) { return $this->usersByDN[$id]; - } else if(isset($this->usersByUid[$id])) { + } elseif(isset($this->usersByUid[$id])) { return $this->usersByUid[$id]; } diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php index 2c038e43285..28eeddccef0 100644 --- a/apps/user_ldap/lib/User/User.php +++ b/apps/user_ldap/lib/User/User.php @@ -131,7 +131,7 @@ class User { if ($username === null) { $log->log("uid for '$dn' must not be null!", ILogger::ERROR); throw new \InvalidArgumentException('uid must not be null!'); - } else if ($username === '') { + } elseif ($username === '') { $log->log("uid for '$dn' must not be an empty string", ILogger::ERROR); throw new \InvalidArgumentException('uid must not be an empty string!'); } @@ -241,7 +241,7 @@ class User { // LDAP Username, needed for s2s sharing if(isset($ldapEntry['uid'])) { $this->storeLDAPUserName($ldapEntry['uid'][0]); - } else if(isset($ldapEntry['samaccountname'])) { + } elseif(isset($ldapEntry['samaccountname'])) { $this->storeLDAPUserName($ldapEntry['samaccountname'][0]); } @@ -548,10 +548,10 @@ class User { $aQuota = $this->access->readAttribute($this->dn, $quotaAttribute); if($aQuota && (count($aQuota) > 0) && $this->verifyQuotaValue($aQuota[0])) { $quota = $aQuota[0]; - } else if(is_array($aQuota) && isset($aQuota[0])) { + } elseif(is_array($aQuota) && isset($aQuota[0])) { $this->log->log('no suitable LDAP quota found for user ' . $this->uid . ': [' . $aQuota[0] . ']', ILogger::DEBUG); } - } else if ($this->verifyQuotaValue($valueFromLDAP)) { + } elseif ($this->verifyQuotaValue($valueFromLDAP)) { $quota = $valueFromLDAP; } else { $this->log->log('no suitable LDAP quota found for user ' . $this->uid . ': [' . $valueFromLDAP . ']', ILogger::DEBUG); @@ -560,7 +560,7 @@ class User { if ($quota === false && $this->verifyQuotaValue($defaultQuota)) { // quota not found using the LDAP attribute (or not parseable). Try the default quota $quota = $defaultQuota; - } else if($quota === false) { + } elseif($quota === false) { $this->log->log('no suitable default quota found for user ' . $this->uid . ': [' . $defaultQuota . ']', ILogger::DEBUG); return; } diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php index 839578cd606..a0dcd0febbf 100644 --- a/apps/user_ldap/lib/Wizard.php +++ b/apps/user_ldap/lib/Wizard.php @@ -106,9 +106,9 @@ class Wizard extends LDAPUtility { $limit = 1001; if($type === 'groups') { $result = $this->access->countGroups($filter, $attr, $limit); - } else if($type === 'users') { + } elseif($type === 'users') { $result = $this->access->countUsers($filter, $attr, $limit); - } else if ($type === 'objects') { + } elseif ($type === 'objects') { $result = $this->access->countObjects($limit); } else { throw new \Exception('Internal error: Invalid object type', 500); @@ -981,9 +981,9 @@ class Wizard extends LDAPUtility { $attr = ''; if(isset($userAttributes['uid'])) { $attr = 'uid'; - } else if(isset($userAttributes['samaccountname'])) { + } elseif(isset($userAttributes['samaccountname'])) { $attr = 'samaccountname'; - } else if(isset($userAttributes['cn'])) { + } elseif(isset($userAttributes['cn'])) { //fallback $attr = 'cn'; } @@ -1239,7 +1239,7 @@ class Wizard extends LDAPUtility { if(is_array($setFeatures) && !empty($setFeatures)) { //something is already configured? pre-select it. $this->result->addChange($dbkey, $setFeatures); - } else if ($po && $maxEntryObjC !== '') { + } elseif ($po && $maxEntryObjC !== '') { //pre-select objectclass with most result entries $maxEntryObjC = str_replace($p, '', $maxEntryObjC); $this->applyFind($dbkey, $maxEntryObjC); diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php index cf6e2d7bb84..305df690358 100644 --- a/apps/user_ldap/tests/Group_LDAPTest.php +++ b/apps/user_ldap/tests/Group_LDAPTest.php @@ -523,7 +523,7 @@ class Group_LDAPTest extends TestCase { ->willReturnCallback(function ($dn, $attr) { if($attr === 'primaryGroupToken') { return [1337]; - } else if($attr === 'gidNumber') { + } elseif($attr === 'gidNumber') { return [4211]; } return []; @@ -657,7 +657,7 @@ class Group_LDAPTest extends TestCase { ->willReturnCallback(function ($name) { if($name === 'useMemberOfToDetectMembership') { return 0; - } else if($name === 'ldapDynamicGroupMemberURL') { + } elseif($name === 'ldapDynamicGroupMemberURL') { return ''; } return 1; @@ -1082,9 +1082,9 @@ class Group_LDAPTest extends TestCase { ->willReturnCallback(function ($name) { if($name === 'ldapGroupMemberAssocAttr') { return 'member'; - } else if($name === 'ldapGroupFilter') { + } elseif($name === 'ldapGroupFilter') { return 'objectclass=nextcloudGroup'; - } else if($name === 'ldapGroupDisplayName') { + } elseif($name === 'ldapGroupDisplayName') { return 'cn'; } return null; diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php index 8dc699f371b..2b0fcd681f9 100644 --- a/apps/user_ldap/tests/User_LDAPTest.php +++ b/apps/user_ldap/tests/User_LDAPTest.php @@ -871,7 +871,7 @@ class User_LDAPTest extends TestCase { ->willReturnCallback(function ($uid) use ($user1, $user2) { if($uid === 'gunslinger') { return $user1; - } else if($uid === 'newyorker') { + } elseif($uid === 'newyorker') { return $user2; } return null; @@ -950,7 +950,7 @@ class User_LDAPTest extends TestCase { ->willReturnCallback(function ($uid) use ($user1, $user2) { if($uid === 'gunslinger') { return $user1; - } else if($uid === 'newyorker') { + } elseif($uid === 'newyorker') { return $user2; } return null; diff --git a/apps/user_ldap/tests/WizardTest.php b/apps/user_ldap/tests/WizardTest.php index 0a94eb2a1f4..67af7e9b177 100644 --- a/apps/user_ldap/tests/WizardTest.php +++ b/apps/user_ldap/tests/WizardTest.php @@ -282,9 +282,9 @@ class WizardTest extends TestCase { ->willReturnCallback(function ($filter) { if($filter === 'myEmailAttribute') { return 0; - } else if($filter === 'mail') { + } elseif($filter === 'mail') { return 3; - } else if($filter === 'mailPrimaryAddress') { + } elseif($filter === 'mailPrimaryAddress') { return 17; } throw new \Exception('Untested filter: ' . $filter); @@ -321,9 +321,9 @@ class WizardTest extends TestCase { ->willReturnCallback(function ($filter) { if($filter === 'myEmailAttribute') { return 0; - } else if($filter === 'mail') { + } elseif($filter === 'mail') { return 3; - } else if($filter === 'mailPrimaryAddress') { + } elseif($filter === 'mailPrimaryAddress') { return 17; } throw new \Exception('Untested filter: ' . $filter); @@ -360,9 +360,9 @@ class WizardTest extends TestCase { ->willReturnCallback(function ($filter) { if($filter === 'myEmailAttribute') { return 0; - } else if($filter === 'mail') { + } elseif($filter === 'mail') { return 0; - } else if($filter === 'mailPrimaryAddress') { + } elseif($filter === 'mailPrimaryAddress') { return 0; } throw new \Exception('Untested filter: ' . $filter); diff --git a/apps/workflowengine/lib/AppInfo/Application.php b/apps/workflowengine/lib/AppInfo/Application.php index 289ac167ac5..d75b025b3f4 100644 --- a/apps/workflowengine/lib/AppInfo/Application.php +++ b/apps/workflowengine/lib/AppInfo/Application.php @@ -112,7 +112,7 @@ class Application extends \OCP\AppFramework\App { if ($event instanceof Event) { $entity->prepareRuleMatcher($ruleMatcher, $eventName, $event); $operation->onEvent($eventName, $event, $ruleMatcher); - } else if ($entity instanceof IEntityCompat && $operation instanceof IOperationCompat) { + } elseif ($entity instanceof IEntityCompat && $operation instanceof IOperationCompat) { // TODO: Remove this block (and the compat classes) in the first major release in 2023 $entity->prepareRuleMatcherCompat($ruleMatcher, $eventName, $event); $operation->onEventCompat($eventName, $event, $ruleMatcher); diff --git a/apps/workflowengine/lib/Check/AbstractStringCheck.php b/apps/workflowengine/lib/Check/AbstractStringCheck.php index e0de77a852b..f42da048f21 100644 --- a/apps/workflowengine/lib/Check/AbstractStringCheck.php +++ b/apps/workflowengine/lib/Check/AbstractStringCheck.php @@ -64,7 +64,7 @@ abstract class AbstractStringCheck implements ICheck { protected function executeStringCheck($operator, $checkValue, $actualValue) { if ($operator === 'is') { return $checkValue === $actualValue; - } else if ($operator === '!is') { + } elseif ($operator === '!is') { return $checkValue !== $actualValue; } else { $match = $this->match($checkValue, $actualValue); diff --git a/apps/workflowengine/lib/Check/FileSystemTags.php b/apps/workflowengine/lib/Check/FileSystemTags.php index 03a55b3caca..845fb3ee718 100644 --- a/apps/workflowengine/lib/Check/FileSystemTags.php +++ b/apps/workflowengine/lib/Check/FileSystemTags.php @@ -134,7 +134,7 @@ class FileSystemTags implements ICheck, IFileCheck { $parentIds = []; if ($path !== $this->dirname($path)) { $parentIds = $this->getFileIds($cache, $this->dirname($path), $isExternalStorage); - } else if (!$isExternalStorage) { + } elseif (!$isExternalStorage) { return []; } diff --git a/apps/workflowengine/lib/Check/RequestRemoteAddress.php b/apps/workflowengine/lib/Check/RequestRemoteAddress.php index 61022a2513b..00d3d9b2577 100644 --- a/apps/workflowengine/lib/Check/RequestRemoteAddress.php +++ b/apps/workflowengine/lib/Check/RequestRemoteAddress.php @@ -53,9 +53,9 @@ class RequestRemoteAddress implements ICheck { if ($operator === 'matchesIPv4') { return $this->matchIPv4($actualValue, $decodedValue[0], $decodedValue[1]); - } else if ($operator === '!matchesIPv4') { + } elseif ($operator === '!matchesIPv4') { return !$this->matchIPv4($actualValue, $decodedValue[0], $decodedValue[1]); - } else if ($operator === 'matchesIPv6') { + } elseif ($operator === 'matchesIPv6') { return $this->matchIPv6($actualValue, $decodedValue[0], $decodedValue[1]); } else { return !$this->matchIPv6($actualValue, $decodedValue[0], $decodedValue[1]); diff --git a/apps/workflowengine/lib/Service/RuleMatcher.php b/apps/workflowengine/lib/Service/RuleMatcher.php index e5dbc08ce1f..b022bafb11a 100644 --- a/apps/workflowengine/lib/Service/RuleMatcher.php +++ b/apps/workflowengine/lib/Service/RuleMatcher.php @@ -220,7 +220,7 @@ class RuleMatcher implements IRuleMatcher { list($entity, $subject) = $entityInfo; $checkInstance->setEntitySubject($entity, $subject); } - } else if(!$checkInstance instanceof ICheck) { + } elseif(!$checkInstance instanceof ICheck) { // Check is invalid throw new \UnexpectedValueException($this->l->t('Check %s is invalid or does not exist', $check['class'])); } diff --git a/apps/workflowengine/tests/ManagerTest.php b/apps/workflowengine/tests/ManagerTest.php index cad4be174cf..191e7bfec84 100644 --- a/apps/workflowengine/tests/ManagerTest.php +++ b/apps/workflowengine/tests/ManagerTest.php @@ -287,7 +287,7 @@ class ManagerTest extends TestCase { ->willReturnCallback(function ($class) { if(substr($class, -2) === 'Op') { return $this->createMock(IOperation::class); - } else if($class === File::class) { + } elseif($class === File::class) { return $this->getMockBuilder(File::class) ->setConstructorArgs([ $this->l, @@ -424,7 +424,7 @@ class ManagerTest extends TestCase { $entityTypeCounts = array_reduce($entities, function (array $carry, IEntity $entity) { if($entity instanceof File) $carry[0]++; - else if($entity instanceof IEntity) $carry[1]++; + elseif($entity instanceof IEntity) $carry[1]++; return $carry; }, [0, 0]); |