diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 10:35:09 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 10:35:09 +0200 |
commit | 14c996d98256de958da367297c3313e0fa7ef9a8 (patch) | |
tree | 27074d5403b67cbaf59d7b7181481ebe70af5d9e | |
parent | d6e17fb01777866674129a5883c03642f4bfd4a5 (diff) | |
download | nextcloud-server-14c996d98256de958da367297c3313e0fa7ef9a8.tar.gz nextcloud-server-14c996d98256de958da367297c3313e0fa7ef9a8.zip |
Use elseif instead of else if
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
218 files changed, 595 insertions, 595 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]); diff --git a/build/integration/features/bootstrap/CommandLine.php b/build/integration/features/bootstrap/CommandLine.php index 85b5b1e7464..ecce68f2973 100644 --- a/build/integration/features/bootstrap/CommandLine.php +++ b/build/integration/features/bootstrap/CommandLine.php @@ -124,7 +124,7 @@ trait CommandLine { $msg .= ' Exceptions: ' . implode(', ', $exceptions); } throw new \Exception($msg); - } else if (!empty($exceptions)) { + } elseif (!empty($exceptions)) { $msg = 'The command was successful but triggered exceptions: ' . implode(', ', $exceptions); throw new \Exception($msg); } diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php index 762e0dcb045..854ce552e6e 100644 --- a/build/integration/features/bootstrap/Sharing.php +++ b/build/integration/features/bootstrap/Sharing.php @@ -616,11 +616,11 @@ trait Sharing { if ($contentExpected === 'A_NUMBER') { Assert::assertTrue(is_numeric((string)$returnedShare->$field), "Field '$field' is not a number: " . $returnedShare->$field); - } else if ($contentExpected === 'A_TOKEN') { + } elseif ($contentExpected === 'A_TOKEN') { // A token is composed by 15 characters from // ISecureRandom::CHAR_HUMAN_READABLE. Assert::assertRegExp('/^[abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789]{15}$/', (string)$returnedShare->$field, "Field '$field' is not a token"); - } else if (strpos($contentExpected, 'REGEXP ') === 0) { + } elseif (strpos($contentExpected, 'REGEXP ') === 0) { Assert::assertRegExp(substr($contentExpected, strlen('REGEXP ')), (string)$returnedShare->$field, "Field '$field' does not match"); } else { Assert::assertEquals($contentExpected, (string)$returnedShare->$field, "Field '$field' does not match"); diff --git a/build/integration/features/bootstrap/TagsContext.php b/build/integration/features/bootstrap/TagsContext.php index c5a18198f01..4cc558dbdad 100644 --- a/build/integration/features/bootstrap/TagsContext.php +++ b/build/integration/features/bootstrap/TagsContext.php @@ -302,7 +302,7 @@ class TagsContext implements \Behat\Behat\Context\Context { if ($can === 'can') { $expected = 'true'; - } else if ($can === 'cannot') { + } elseif ($can === 'cannot') { $expected = 'false'; } else { throw new \Exception('Invalid condition, must be "can" or "cannot"'); diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 49ff3d85c88..e9123b02904 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -88,7 +88,7 @@ trait WebDav { public function makeDavRequest($user, $method, $path, $headers, $body = null, $type = "files") { if ($type === "files") { $fullUrl = substr($this->baseUrl, 0, -4) . $this->getDavFilesPath($user) . "$path"; - } else if ($type === "uploads") { + } elseif ($type === "uploads") { $fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath . "$path"; } $client = new GClient(); diff --git a/console.php b/console.php index b867ea6316a..498e080cecd 100644 --- a/console.php +++ b/console.php @@ -78,7 +78,7 @@ try { if ($oldWorkingDir === false) { echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; echo "Can't determine current working dir - the script will continue to work but be aware of the above fact." . PHP_EOL; - } else if ($oldWorkingDir !== __DIR__ && !chdir(__DIR__)) { + } elseif ($oldWorkingDir !== __DIR__ && !chdir(__DIR__)) { echo "This script can be run from the Nextcloud root directory only." . PHP_EOL; echo "Can't change to Nextcloud root directory." . PHP_EOL; exit(1); diff --git a/core/Command/App/Update.php b/core/Command/App/Update.php index 8aa7bccb1a2..4be2f4639ef 100644 --- a/core/Command/App/Update.php +++ b/core/Command/App/Update.php @@ -92,7 +92,7 @@ class Update extends Command { return 1; } - } else if ($input->getOption('all') || $input->getOption('showonly')) { + } elseif ($input->getOption('all') || $input->getOption('showonly')) { $apps = \OC_App::getAllApps(); } else { $output->writeln("<error>Please specify an app to update or \"--all\" to update all updatable apps\"</error>"); @@ -117,7 +117,7 @@ class Update extends Command { if ($result === false) { $output->writeln($appId . ' couldn\'t be updated'); $return = 1; - } else if($result === true) { + } elseif($result === true) { $output->writeln($appId . ' updated'); } } diff --git a/core/Command/Base.php b/core/Command/Base.php index 678f0286db5..9c20e049311 100644 --- a/core/Command/Base.php +++ b/core/Command/Base.php @@ -121,9 +121,9 @@ class Base extends Command implements CompletionAwareInterface { protected function valueToString($value, $returnNull = true) { if ($value === false) { return 'false'; - } else if ($value === true) { + } elseif ($value === true) { return 'true'; - } else if ($value === null) { + } elseif ($value === null) { return $returnNull ? null : 'null'; } else { return $value; diff --git a/core/Command/Config/System/DeleteConfig.php b/core/Command/Config/System/DeleteConfig.php index 22e83b15f79..85531c4c4bf 100644 --- a/core/Command/Config/System/DeleteConfig.php +++ b/core/Command/Config/System/DeleteConfig.php @@ -106,10 +106,10 @@ class DeleteConfig extends Base { } else { $currentValue[$nextKey] = $this->removeSubValue($keys, $currentValue[$nextKey], $throwError); } - } else if ($throwError) { + } elseif ($throwError) { throw new \UnexpectedValueException('Config parameter does not exist'); } - } else if ($throwError) { + } elseif ($throwError) { throw new \UnexpectedValueException('Config parameter does not exist'); } diff --git a/core/Command/Config/System/GetConfig.php b/core/Command/Config/System/GetConfig.php index ec4ea7e2577..5d77518db21 100644 --- a/core/Command/Config/System/GetConfig.php +++ b/core/Command/Config/System/GetConfig.php @@ -84,7 +84,7 @@ class GetConfig extends Base { foreach ($configNames as $configName) { if (isset($configValue[$configName])) { $configValue = $configValue[$configName]; - } else if (!$input->hasParameterOption('--default-value')) { + } elseif (!$input->hasParameterOption('--default-value')) { return 1; } else { $configValue = $defaultValue; diff --git a/core/Command/Db/Migrations/GenerateFromSchemaFileCommand.php b/core/Command/Db/Migrations/GenerateFromSchemaFileCommand.php index b3d826c1e5b..7db08ba0061 100644 --- a/core/Command/Db/Migrations/GenerateFromSchemaFileCommand.php +++ b/core/Command/Db/Migrations/GenerateFromSchemaFileCommand.php @@ -129,7 +129,7 @@ EOT if ($default !== null) { if (is_string($default)) { $default = "'$default'"; - } else if (is_bool($default)) { + } elseif (is_bool($default)) { $default = ($default === true) ? 'true' : 'false'; } $content .= str_replace('{{default}}', $default, <<<'EOT' diff --git a/core/Command/Encryption/DecryptAll.php b/core/Command/Encryption/DecryptAll.php index b4dc3e0160a..af1aa4c792c 100644 --- a/core/Command/Encryption/DecryptAll.php +++ b/core/Command/Encryption/DecryptAll.php @@ -175,7 +175,7 @@ class DecryptAll extends Command { $output->writeln(' aborted.'); $output->writeln('Server side encryption remains enabled'); $this->config->setAppValue('core', 'encryption_enabled', 'yes'); - } else if ($uid !== '') { + } elseif ($uid !== '') { $output->writeln('Server side encryption remains enabled'); $this->config->setAppValue('core', 'encryption_enabled', 'yes'); } diff --git a/core/Command/Encryption/Enable.php b/core/Command/Encryption/Enable.php index c9b842bd2a6..6391eede858 100644 --- a/core/Command/Encryption/Enable.php +++ b/core/Command/Encryption/Enable.php @@ -69,7 +69,7 @@ class Enable extends Command { $defaultModule = $this->config->getAppValue('core', 'default_encryption_module', null); if ($defaultModule === null) { $output->writeln('<error>No default module is set</error>'); - } else if (!isset($modules[$defaultModule])) { + } elseif (!isset($modules[$defaultModule])) { $output->writeln('<error>The current default module does not exist: ' . $defaultModule . '</error>'); } else { $output->writeln('Default module: ' . $defaultModule); diff --git a/core/Command/Encryption/SetDefaultModule.php b/core/Command/Encryption/SetDefaultModule.php index 5f73792d99b..f84ed19621a 100644 --- a/core/Command/Encryption/SetDefaultModule.php +++ b/core/Command/Encryption/SetDefaultModule.php @@ -76,7 +76,7 @@ class SetDefaultModule extends Command { if ($moduleId === $this->encryptionManager->getDefaultEncryptionModuleId()) { $output->writeln('"' . $moduleId . '"" is already the default module'); - } else if ($this->encryptionManager->setDefaultEncryptionModule($moduleId)) { + } elseif ($this->encryptionManager->setDefaultEncryptionModule($moduleId)) { $output->writeln('<info>Set default module to "' . $moduleId . '"</info>'); } else { $output->writeln('<error>The specified module "' . $moduleId . '" does not exist</error>'); diff --git a/core/Command/L10n/CreateJs.php b/core/Command/L10n/CreateJs.php index ac6e7339422..fd337994e86 100644 --- a/core/Command/L10n/CreateJs.php +++ b/core/Command/L10n/CreateJs.php @@ -161,7 +161,7 @@ class CreateJs extends Command implements CompletionAwareInterface { public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'app') { return \OC_App::getAllApps(); - } else if ($argumentName === 'lang') { + } elseif ($argumentName === 'lang') { $appName = $context->getWordAtIndex($context->getWordIndex() - 1); return $this->getAllLanguages(\OC_App::getAppPath($appName)); } diff --git a/core/Command/Log/File.php b/core/Command/Log/File.php index df5e1ba53ab..2bf77224cd5 100644 --- a/core/Command/Log/File.php +++ b/core/Command/Log/File.php @@ -143,7 +143,7 @@ class File extends Command implements Completion\CompletionAwareInterface { Completion::TYPE_OPTION ); return $helper->run(); - } else if ($optionName === 'rotate-size') { + } elseif ($optionName === 'rotate-size') { return [0]; } return []; diff --git a/core/Command/Log/Manage.php b/core/Command/Log/Manage.php index b2816ea5f4b..062bc866cc9 100644 --- a/core/Command/Log/Manage.php +++ b/core/Command/Log/Manage.php @@ -188,9 +188,9 @@ class Manage extends Command implements CompletionAwareInterface { public function completeOptionValues($optionName, CompletionContext $context) { if ($optionName === 'backend') { return ['file', 'syslog', 'errorlog', 'systemd']; - } else if ($optionName === 'level') { + } elseif ($optionName === 'level') { return ['debug', 'info', 'warning', 'error', 'fatal']; - } else if ($optionName === 'timezone') { + } elseif ($optionName === 'timezone') { return \DateTimeZone::listIdentifiers(); } return []; diff --git a/core/Command/Upgrade.php b/core/Command/Upgrade.php index dadcdb0904c..761a6fb55c0 100644 --- a/core/Command/Upgrade.php +++ b/core/Command/Upgrade.php @@ -264,7 +264,7 @@ class Upgrade extends Command { } return self::ERROR_SUCCESS; - } else if($this->config->getSystemValueBool('maintenance')) { + } elseif($this->config->getSystemValueBool('maintenance')) { //Possible scenario: Nextcloud core is updated but an app failed $output->writeln('<warning>Nextcloud is in maintenance mode</warning>'); $output->write('<comment>Maybe an upgrade is already in process. Please check the ' diff --git a/core/Command/User/Setting.php b/core/Command/User/Setting.php index 521ac850b92..e084b94cc8a 100644 --- a/core/Command/User/Setting.php +++ b/core/Command/User/Setting.php @@ -188,7 +188,7 @@ class Setting extends Base { $this->config->setUserValue($uid, $app, $key, $input->getArgument('value')); return 0; - } else if ($input->hasParameterOption('--delete')) { + } elseif ($input->hasParameterOption('--delete')) { if ($input->hasParameterOption('--error-if-not-exists') && $value === null) { $output->writeln('<error>The setting does not exist for user "' . $uid . '".</error>'); return 1; @@ -205,7 +205,7 @@ class Setting extends Base { $this->config->deleteUserValue($uid, $app, $key); return 0; - } else if ($value !== null) { + } elseif ($value !== null) { $output->writeln($value); return 0; } else { diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index ffdfd9f9f0a..5df6ce5c7b6 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -385,7 +385,7 @@ class ClientFlowLoginController extends Controller { if (strpos($this->request->getRequestUri(), '/index.php') !== false) { $serverPostfix = substr($this->request->getRequestUri(), 0, strpos($this->request->getRequestUri(), '/index.php')); - } else if (strpos($this->request->getRequestUri(), '/login/flow') !== false) { + } elseif (strpos($this->request->getRequestUri(), '/login/flow') !== false) { $serverPostfix = substr($this->request->getRequestUri(), 0, strpos($this->request->getRequestUri(), '/login/flow')); } diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php index 836606d301b..b5b69972832 100644 --- a/core/Controller/ClientFlowLoginV2Controller.php +++ b/core/Controller/ClientFlowLoginV2Controller.php @@ -291,7 +291,7 @@ class ClientFlowLoginV2Controller extends Controller { if (strpos($this->request->getRequestUri(), '/index.php') !== false) { $serverPostfix = substr($this->request->getRequestUri(), 0, strpos($this->request->getRequestUri(), '/index.php')); - } else if (strpos($this->request->getRequestUri(), '/login/v2') !== false) { + } elseif (strpos($this->request->getRequestUri(), '/login/v2') !== false) { $serverPostfix = substr($this->request->getRequestUri(), 0, strpos($this->request->getRequestUri(), '/login/v2')); } diff --git a/core/Middleware/TwoFactorMiddleware.php b/core/Middleware/TwoFactorMiddleware.php index ba97f864ad6..392ae7ca1ca 100644 --- a/core/Middleware/TwoFactorMiddleware.php +++ b/core/Middleware/TwoFactorMiddleware.php @@ -114,7 +114,7 @@ class TwoFactorMiddleware extends Middleware { if ($this->session->exists('app_password') || $this->twoFactorManager->isTwoFactorAuthenticated($user)) { $this->checkTwoFactor($controller, $methodName, $user); - } else if ($controller instanceof TwoFactorChallengeController) { + } elseif ($controller instanceof TwoFactorChallengeController) { // Allow access to the two-factor controllers only if two-factor authentication // is in progress. throw new UserAlreadyLoggedInException(); diff --git a/lib/private/Activity/EventMerger.php b/lib/private/Activity/EventMerger.php index 35c798afe49..4855c0e8447 100644 --- a/lib/private/Activity/EventMerger.php +++ b/lib/private/Activity/EventMerger.php @@ -248,7 +248,7 @@ class EventMerger implements IEventMerger { $placeholders[] = '{' . $placeholder . '}'; if ($parameter['type'] === 'file') { $replacements[] = trim($parameter['path'], '/'); - } else if (isset($parameter['name'])) { + } elseif (isset($parameter['name'])) { $replacements[] = $parameter['name']; } else { $replacements[] = $parameter['id']; diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php index e62b000938b..e1517440b46 100644 --- a/lib/private/AllConfig.php +++ b/lib/private/AllConfig.php @@ -265,7 +265,7 @@ class AllConfig implements \OCP\IConfig { if ($prevValue !== null) { if ($prevValue === (string)$value) { return; - } else if ($preCondition !== null && $prevValue !== (string)$preCondition) { + } elseif ($preCondition !== null && $prevValue !== (string)$preCondition) { throw new PreConditionNotMetException(); } else { $qb = $this->connection->getQueryBuilder(); diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index eaa203417b2..bf1e8492aa3 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -546,7 +546,7 @@ class AppManager implements IAppManager { $info = $this->getAppInfo($appId); if ($info === null) { $incompatibleApps[] = ['id' => $appId]; - } else if (!\OC_App::isAppCompatible($version, $info)) { + } elseif (!\OC_App::isAppCompatible($version, $info)) { $incompatibleApps[] = $info; } } diff --git a/lib/private/App/CodeChecker/MigrationSchemaChecker.php b/lib/private/App/CodeChecker/MigrationSchemaChecker.php index 8434dd72078..63e35e0647c 100644 --- a/lib/private/App/CodeChecker/MigrationSchemaChecker.php +++ b/lib/private/App/CodeChecker/MigrationSchemaChecker.php @@ -66,12 +66,12 @@ class MigrationSchemaChecker extends NodeVisitorAbstract { $this->tableVariableNames[$node->var->name] = $node->expr->args[0]->value->value; } } - } else if ($node->expr->name === 'getTable') { + } elseif ($node->expr->name === 'getTable') { if (isset($node->expr->args[0]) && $node->expr->args[0]->value instanceof Node\Scalar\String_) { $this->tableVariableNames[$node->var->name] = $node->expr->args[0]->value->value; } } - } else if ($this->schemaVariableName !== null && + } elseif ($this->schemaVariableName !== null && $node instanceof Node\Expr\MethodCall && $node->var instanceof Node\Expr\Variable && $node->var->name === $this->schemaVariableName) { @@ -90,7 +90,7 @@ class MigrationSchemaChecker extends NodeVisitorAbstract { /** * Check columns and Indexes */ - } else if (!empty($this->tableVariableNames) && + } elseif (!empty($this->tableVariableNames) && $node instanceof Node\Expr\MethodCall && $node->var instanceof Node\Expr\Variable && isset($this->tableVariableNames[$node->var->name])) { @@ -123,7 +123,7 @@ class MigrationSchemaChecker extends NodeVisitorAbstract { } } } - } else if ($node->name === 'addIndex' || + } elseif ($node->name === 'addIndex' || $node->name === 'addUniqueIndex' || $node->name === 'renameIndex' || $node->name === 'setPrimaryKey') { @@ -139,7 +139,7 @@ class MigrationSchemaChecker extends NodeVisitorAbstract { ]; } } - } else if ($node->name === 'addForeignKeyConstraint') { + } elseif ($node->name === 'addForeignKeyConstraint') { if (isset($node->args[4]) && $node->args[4]->value instanceof Node\Scalar\String_) { if (!$this->checkNameLength($node->args[4]->value->value)) { $this->errors[] = [ @@ -152,7 +152,7 @@ class MigrationSchemaChecker extends NodeVisitorAbstract { ]; } } - } else if ($node->name === 'renameColumn') { + } elseif ($node->name === 'renameColumn') { $this->errors[] = [ 'line' => $node->getLine(), 'disallowedToken' => 'Deprecated method', @@ -166,7 +166,7 @@ class MigrationSchemaChecker extends NodeVisitorAbstract { /** * Find the schema */ - } else if ($node instanceof Node\Expr\Assign && + } elseif ($node instanceof Node\Expr\Assign && $node->expr instanceof Node\Expr\FuncCall && $node->var instanceof Node\Expr\Variable && $node->expr->name instanceof Node\Expr\Variable && diff --git a/lib/private/App/CompareVersion.php b/lib/private/App/CompareVersion.php index bf528e3f1b8..314db1eadd6 100644 --- a/lib/private/App/CompareVersion.php +++ b/lib/private/App/CompareVersion.php @@ -53,9 +53,9 @@ class CompareVersion { if (preg_match(self::REGEX_MAJOR, $required) === 1) { return $this->compareMajor($actual, $required, $comparator); - } else if (preg_match(self::REGEX_MAJOR_MINOR, $required) === 1) { + } elseif (preg_match(self::REGEX_MAJOR_MINOR, $required) === 1) { return $this->compareMajorMinor($actual, $required, $comparator); - } else if (preg_match(self::REGEX_MAJOR_MINOR_PATCH, $required) === 1) { + } elseif (preg_match(self::REGEX_MAJOR_MINOR_PATCH, $required) === 1) { return $this->compareMajorMinorPatch($actual, $required, $comparator); } else { throw new InvalidArgumentException('required version is invalid'); diff --git a/lib/private/AppFramework/App.php b/lib/private/AppFramework/App.php index f7defda487e..382425ad046 100644 --- a/lib/private/AppFramework/App.php +++ b/lib/private/AppFramework/App.php @@ -99,7 +99,7 @@ class App { public static function main(string $controllerName, string $methodName, DIContainer $container, array $urlParams = null) { if (!is_null($urlParams)) { $container->query(IRequest::class)->setUrlParameters($urlParams); - } else if (isset($container['urlParams']) && !is_null($container['urlParams'])) { + } elseif (isset($container['urlParams']) && !is_null($container['urlParams'])) { $container->query(IRequest::class)->setUrlParameters($container['urlParams']); } $appName = $container['AppName']; @@ -178,7 +178,7 @@ class App { if (!$emptyResponse) { if ($response instanceof ICallbackResponse) { $response->callback($io); - } else if (!is_null($output)) { + } elseif (!is_null($output)) { $io->setHeader('Content-Length: ' . strlen($output)); $io->setOutput($output); } diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php index 14898fadf95..2ce504304dc 100644 --- a/lib/private/AppFramework/DependencyInjection/DIContainer.php +++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php @@ -409,9 +409,9 @@ class DIContainer extends SimpleContainer implements IAppContainer { } else { if ($this['AppName'] === 'settings' && strpos($name, 'OC\\Settings\\') === 0) { return parent::query($name); - } else if ($this['AppName'] === 'core' && strpos($name, 'OC\\Core\\') === 0) { + } elseif ($this['AppName'] === 'core' && strpos($name, 'OC\\Core\\') === 0) { return parent::query($name); - } else if (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName']) . '\\') === 0) { + } elseif (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName']) . '\\') === 0) { return parent::query($name); } } diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index 9b8c0690ba6..5430d1ae922 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -874,7 +874,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { } else { if (isset($this->server['HTTP_HOST'])) { $host = $this->server['HTTP_HOST']; - } else if (isset($this->server['SERVER_NAME'])) { + } elseif (isset($this->server['SERVER_NAME'])) { $host = $this->server['SERVER_NAME']; } } diff --git a/lib/private/AppFramework/OCS/V2Response.php b/lib/private/AppFramework/OCS/V2Response.php index 0859fecb1d9..693d58a4d43 100644 --- a/lib/private/AppFramework/OCS/V2Response.php +++ b/lib/private/AppFramework/OCS/V2Response.php @@ -39,11 +39,11 @@ class V2Response extends BaseResponse { $status = parent::getStatus(); if ($status === API::RESPOND_UNAUTHORISED) { return Http::STATUS_UNAUTHORIZED; - } else if ($status === API::RESPOND_NOT_FOUND) { + } elseif ($status === API::RESPOND_NOT_FOUND) { return Http::STATUS_NOT_FOUND; - } else if ($status === API::RESPOND_SERVER_ERROR || $status === API::RESPOND_UNKNOWN_ERROR) { + } elseif ($status === API::RESPOND_SERVER_ERROR || $status === API::RESPOND_UNKNOWN_ERROR) { return Http::STATUS_INTERNAL_SERVER_ERROR; - } else if ($status < 200 || $status > 600) { + } elseif ($status < 200 || $status > 600) { return Http::STATUS_BAD_REQUEST; } diff --git a/lib/private/AppFramework/Routing/RouteConfig.php b/lib/private/AppFramework/Routing/RouteConfig.php index ec6c3971552..999412979b0 100644 --- a/lib/private/AppFramework/Routing/RouteConfig.php +++ b/lib/private/AppFramework/Routing/RouteConfig.php @@ -167,7 +167,7 @@ class RouteConfig { $controllerName = str_replace('controllerController', 'Controller', $controllerName); if ($controllerName === 'PublicpreviewController') { $controllerName = 'PublicPreviewController'; - } else if ($controllerName === 'RequesthandlerController') { + } elseif ($controllerName === 'RequesthandlerController') { $controllerName = 'RequestHandlerController'; } $controllerName = App::buildAppNamespace($appName) . '\\Controller\\' . $controllerName; diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php index f2ac4f2d6f2..1703df3ea73 100644 --- a/lib/private/AppFramework/Utility/SimpleContainer.php +++ b/lib/private/AppFramework/Utility/SimpleContainer.php @@ -72,7 +72,7 @@ class SimpleContainer extends Container implements IContainer { // Service not found, use the default value when available if ($parameter->isDefaultValueAvailable()) { $parameters[] = $parameter->getDefaultValue(); - } else if ($parameterClass !== null) { + } elseif ($parameterClass !== null) { $resolveName = $parameter->getName(); $parameters[] = $this->query($resolveName); } else { @@ -111,7 +111,7 @@ class SimpleContainer extends Container implements IContainer { $name = $this->sanitizeName($name); if ($this->offsetExists($name)) { return $this->offsetGet($name); - } else if ($autoload) { + } elseif ($autoload) { $object = $this->resolve($name); $this->registerService($name, function () use ($object) { return $object; diff --git a/lib/private/Authentication/Listeners/RemoteWipeActivityListener.php b/lib/private/Authentication/Listeners/RemoteWipeActivityListener.php index f7d3693acc9..5acd228b133 100644 --- a/lib/private/Authentication/Listeners/RemoteWipeActivityListener.php +++ b/lib/private/Authentication/Listeners/RemoteWipeActivityListener.php @@ -52,7 +52,7 @@ class RemoteWipeActivityListener implements IEventListener { public function handle(Event $event): void { if ($event instanceof RemoteWipeStarted) { $this->publishActivity('remote_wipe_start', $event->getToken()); - } else if ($event instanceof RemoteWipeFinished) { + } elseif ($event instanceof RemoteWipeFinished) { $this->publishActivity('remote_wipe_finish', $event->getToken()); } } diff --git a/lib/private/Authentication/Listeners/RemoteWipeEmailListener.php b/lib/private/Authentication/Listeners/RemoteWipeEmailListener.php index 0632d2e6af0..6c0ca16859b 100644 --- a/lib/private/Authentication/Listeners/RemoteWipeEmailListener.php +++ b/lib/private/Authentication/Listeners/RemoteWipeEmailListener.php @@ -90,7 +90,7 @@ class RemoteWipeEmailListener implements IEventListener { 'level' => ILogger::ERROR, ]); } - } else if ($event instanceof RemoteWipeFinished) { + } elseif ($event instanceof RemoteWipeFinished) { $uid = $event->getToken()->getUID(); $user = $this->userManager->get($uid); if ($user === null) { diff --git a/lib/private/Authentication/Listeners/RemoteWipeNotificationsListener.php b/lib/private/Authentication/Listeners/RemoteWipeNotificationsListener.php index 9eab3e74e9c..4b021d67c75 100644 --- a/lib/private/Authentication/Listeners/RemoteWipeNotificationsListener.php +++ b/lib/private/Authentication/Listeners/RemoteWipeNotificationsListener.php @@ -52,7 +52,7 @@ class RemoteWipeNotificationsListener implements IEventListener { public function handle(Event $event): void { if ($event instanceof RemoteWipeStarted) { $this->sendNotification('remote_wipe_start', $event->getToken()); - } else if ($event instanceof RemoteWipeFinished) { + } elseif ($event instanceof RemoteWipeFinished) { $this->sendNotification('remote_wipe_finish', $event->getToken()); } } diff --git a/lib/private/Authentication/Login/TwoFactorCommand.php b/lib/private/Authentication/Login/TwoFactorCommand.php index 2d889ef8c70..2c3d2fbf2c4 100644 --- a/lib/private/Authentication/Login/TwoFactorCommand.php +++ b/lib/private/Authentication/Login/TwoFactorCommand.php @@ -69,7 +69,7 @@ class TwoFactorCommand extends ALoginCommand { // No providers set up, but 2FA is enforced and setup providers are available $url = 'core.TwoFactorChallenge.setupProviders'; $urlParams = []; - } else if (!$providerSet->isProviderMissing() && count($providers) === 1) { + } elseif (!$providerSet->isProviderMissing() && count($providers) === 1) { // Single provider (and no missing ones), hence we can redirect to that provider's challenge page directly /* @var $provider IProvider */ $provider = array_pop($providers); diff --git a/lib/private/Command/CronBus.php b/lib/private/Command/CronBus.php index 94235925096..86fa919d5f3 100644 --- a/lib/private/Command/CronBus.php +++ b/lib/private/Command/CronBus.php @@ -52,9 +52,9 @@ class CronBus extends AsyncBus { private function getJobClass($command) { if ($command instanceof \Closure) { return ClosureJob::class; - } else if (is_callable($command)) { + } elseif (is_callable($command)) { return CallableJob::class; - } else if ($command instanceof ICommand) { + } elseif ($command instanceof ICommand) { return CommandJob::class; } else { throw new \InvalidArgumentException('Invalid command'); @@ -69,7 +69,7 @@ class CronBus extends AsyncBus { if ($command instanceof \Closure) { $serializer = new Serializer(); return $serializer->serialize($command); - } else if (is_callable($command) or $command instanceof ICommand) { + } elseif (is_callable($command) or $command instanceof ICommand) { return serialize($command); } else { throw new \InvalidArgumentException('Invalid command'); diff --git a/lib/private/Console/Application.php b/lib/private/Console/Application.php index 0688a193693..00ab67f93be 100644 --- a/lib/private/Console/Application.php +++ b/lib/private/Console/Application.php @@ -146,7 +146,7 @@ class Application { } } } - } else if ($input->getArgument('command') !== '_completion' && $input->getArgument('command') !== 'maintenance:install') { + } elseif ($input->getArgument('command') !== '_completion' && $input->getArgument('command') !== 'maintenance:install') { $output->writeln("Nextcloud is not installed - only a limited number of commands are available"); } } catch(NeedsUpdateException $e) { diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index a0c0ac18481..15c0272915a 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -265,7 +265,7 @@ class Connection extends ReconnectWrapper implements IDBConnection { private function getType($value) { if (is_bool($value)) { return IQueryBuilder::PARAM_BOOL; - } else if (is_int($value)) { + } elseif (is_int($value)) { return IQueryBuilder::PARAM_INT; } else { return IQueryBuilder::PARAM_STR; diff --git a/lib/private/DB/MDB2SchemaManager.php b/lib/private/DB/MDB2SchemaManager.php index bc05bd354f2..36184b51252 100644 --- a/lib/private/DB/MDB2SchemaManager.php +++ b/lib/private/DB/MDB2SchemaManager.php @@ -83,11 +83,11 @@ class MDB2SchemaManager { $dispatcher = \OC::$server->getEventDispatcher(); if ($platform instanceof SqlitePlatform) { return new SQLiteMigrator($this->conn, $random, $config, $dispatcher); - } else if ($platform instanceof OraclePlatform) { + } elseif ($platform instanceof OraclePlatform) { return new OracleMigrator($this->conn, $random, $config, $dispatcher); - } else if ($platform instanceof MySqlPlatform) { + } elseif ($platform instanceof MySqlPlatform) { return new MySQLMigrator($this->conn, $random, $config, $dispatcher); - } else if ($platform instanceof PostgreSqlPlatform) { + } elseif ($platform instanceof PostgreSqlPlatform) { return new PostgreSqlMigrator($this->conn, $random, $config, $dispatcher); } else { return new Migrator($this->conn, $random, $config, $dispatcher); diff --git a/lib/private/DB/MDB2SchemaReader.php b/lib/private/DB/MDB2SchemaReader.php index 7265c978616..66a45fb5fc5 100644 --- a/lib/private/DB/MDB2SchemaReader.php +++ b/lib/private/DB/MDB2SchemaReader.php @@ -247,7 +247,7 @@ class MDB2SchemaReader { $length = $options['length']; if ($length < 4) { $type = 'smallint'; - } else if ($length > 4) { + } elseif ($length > 4) { $type = 'bigint'; } } diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php index dd719ef0a5b..0104c1be367 100644 --- a/lib/private/DB/MigrationService.php +++ b/lib/private/DB/MigrationService.php @@ -97,7 +97,7 @@ class MigrationService { foreach ($info['dependencies']['database'] as $database) { if (\is_string($database) && $database === 'oci') { $this->checkOracle = true; - } else if (\is_array($database) && isset($database['@value']) && $database['@value'] === 'oci') { + } elseif (\is_array($database) && isset($database['@value']) && $database['@value'] === 'oci') { $this->checkOracle = true; } } @@ -542,7 +542,7 @@ class MigrationService { return $sequence->getName() !== $sequenceName; }); } - } else if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) { + } elseif ($this->connection->getDatabasePlatform() instanceof OraclePlatform) { $defaultName = $table->getName() . '_seq'; $isUsingDefaultName = strtolower($defaultName) === $indexName; } diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php index bd0869673aa..4845b8b1aa4 100644 --- a/lib/private/DB/QueryBuilder/QueryBuilder.php +++ b/lib/private/DB/QueryBuilder/QueryBuilder.php @@ -115,11 +115,11 @@ class QueryBuilder implements IQueryBuilder { public function expr() { if ($this->connection instanceof OracleConnection) { return new OCIExpressionBuilder($this->connection, $this); - } else if ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) { + } elseif ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) { return new PgSqlExpressionBuilder($this->connection, $this); - } else if ($this->connection->getDatabasePlatform() instanceof MySqlPlatform) { + } elseif ($this->connection->getDatabasePlatform() instanceof MySqlPlatform) { return new MySqlExpressionBuilder($this->connection, $this); - } else if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) { + } elseif ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) { return new SqliteExpressionBuilder($this->connection, $this); } else { return new ExpressionBuilder($this->connection, $this); @@ -145,9 +145,9 @@ class QueryBuilder implements IQueryBuilder { public function func() { if ($this->connection instanceof OracleConnection) { return new OCIFunctionBuilder($this->helper); - } else if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) { + } elseif ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) { return new SqliteFunctionBuilder($this->helper); - } else if ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) { + } elseif ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) { return new PgSqlFunctionBuilder($this->helper); } else { return new FunctionBuilder($this->helper); diff --git a/lib/private/DateTimeFormatter.php b/lib/private/DateTimeFormatter.php index bb9e018b584..45a1cbdb8f2 100644 --- a/lib/private/DateTimeFormatter.php +++ b/lib/private/DateTimeFormatter.php @@ -81,7 +81,7 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { protected function getDateTime($timestamp, \DateTimeZone $timeZone = null) { if ($timestamp === null) { return new \DateTime('now', $timeZone); - } else if (!$timestamp instanceof \DateTime) { + } elseif (!$timestamp instanceof \DateTime) { $dateTime = new \DateTime('now', $timeZone); $dateTime->setTimestamp($timestamp); return $dateTime; @@ -160,31 +160,31 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { if ($dateInterval->y == 0 && $dateInterval->m == 0 && $dateInterval->d == 0) { return $l->t('today'); - } else if ($dateInterval->y == 0 && $dateInterval->m == 0 && $dateInterval->d == 1) { + } elseif ($dateInterval->y == 0 && $dateInterval->m == 0 && $dateInterval->d == 1) { if ($timestamp > $baseTimestamp) { return $l->t('tomorrow'); } else { return $l->t('yesterday'); } - } else if ($dateInterval->y == 0 && $dateInterval->m == 0) { + } elseif ($dateInterval->y == 0 && $dateInterval->m == 0) { if ($timestamp > $baseTimestamp) { return $l->n('in %n day', 'in %n days', $dateInterval->d); } else { return $l->n('%n day ago', '%n days ago', $dateInterval->d); } - } else if ($dateInterval->y == 0 && $dateInterval->m == 1) { + } elseif ($dateInterval->y == 0 && $dateInterval->m == 1) { if ($timestamp > $baseTimestamp) { return $l->t('next month'); } else { return $l->t('last month'); } - } else if ($dateInterval->y == 0) { + } elseif ($dateInterval->y == 0) { if ($timestamp > $baseTimestamp) { return $l->n('in %n month', 'in %n months', $dateInterval->m); } else { return $l->n('%n month ago', '%n months ago', $dateInterval->m); } - } else if ($dateInterval->y == 1) { + } elseif ($dateInterval->y == 1) { if ($timestamp > $baseTimestamp) { return $l->t('next year'); } else { @@ -250,7 +250,7 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { } else { return $l->n('%n hour ago', '%n hours ago', $diff->h); } - } else if ($diff->i > 0) { + } elseif ($diff->i > 0) { if ($timestamp > $baseTimestamp) { return $l->n('in %n minute', 'in %n minutes', $diff->i); } else { diff --git a/lib/private/Federation/CloudIdManager.php b/lib/private/Federation/CloudIdManager.php index 9c877c5efc7..6d4df7a66c5 100644 --- a/lib/private/Federation/CloudIdManager.php +++ b/lib/private/Federation/CloudIdManager.php @@ -51,9 +51,9 @@ class CloudIdManager implements ICloudIdManager { if ($posSlash === false && $posColon === false) { $invalidPos = \strlen($id); - } else if ($posSlash === false) { + } elseif ($posSlash === false) { $invalidPos = $posColon; - } else if ($posColon === false) { + } elseif ($posColon === false) { $invalidPos = $posSlash; } else { $invalidPos = min($posSlash, $posColon); diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index a6daec2a8f3..bce9a1d88e0 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -155,7 +155,7 @@ class Cache implements ICache { //merge partial data if (!$data and is_string($file) and isset($this->partial[$file])) { return $this->partial[$file]; - } else if (!$data) { + } elseif (!$data) { return $data; } else { return self::cacheEntryFromData($data, $this->mimetypeLoader); @@ -425,14 +425,14 @@ class Cache implements ICache { if (array_search($name, $fields) !== false) { if ($name === 'path') { $params['path_hash'] = md5($value); - } else if ($name === 'mimetype') { + } elseif ($name === 'mimetype') { $params['mimepart'] = $this->mimetypeLoader->getId(substr($value, 0, strpos($value, '/'))); $value = $this->mimetypeLoader->getId($value); - } else if ($name === 'storage_mtime') { + } elseif ($name === 'storage_mtime') { if (!$doNotCopyStorageMTime && !isset($data['mtime'])) { $params['mtime'] = $value; } - } else if ($name === 'encrypted') { + } elseif ($name === 'encrypted') { if (isset($data['encryptedVersion'])) { $value = $data['encryptedVersion']; } else { diff --git a/lib/private/Files/Cache/QuerySearchHelper.php b/lib/private/Files/Cache/QuerySearchHelper.php index 7a0b9f3a24a..9f2d7aadd7e 100644 --- a/lib/private/Files/Cache/QuerySearchHelper.php +++ b/lib/private/Files/Cache/QuerySearchHelper.php @@ -79,7 +79,7 @@ class QuerySearchHelper { return array_reduce($operator->getArguments(), function ($shouldJoin, ISearchOperator $operator) { return $shouldJoin || $this->shouldJoinTags($operator); }, false); - } else if ($operator instanceof ISearchComparison) { + } elseif ($operator instanceof ISearchComparison) { return $operator->getField() === 'tagname' || $operator->getField() === 'favorite'; } return false; @@ -117,7 +117,7 @@ class QuerySearchHelper { default: throw new \InvalidArgumentException('Invalid operator type: ' . $operator->getType()); } - } else if ($operator instanceof ISearchComparison) { + } elseif ($operator instanceof ISearchComparison) { return $this->searchComparisonToDBExpr($builder, $operator, self::$searchOperatorMap); } else { throw new \InvalidArgumentException('Invalid operator type: ' . get_class($operator)); @@ -143,13 +143,13 @@ class QuerySearchHelper { if ($field === 'mimetype') { if ($operator->getType() === ISearchComparison::COMPARE_EQUAL) { $value = (int)$this->mimetypeLoader->getId($value); - } else if ($operator->getType() === ISearchComparison::COMPARE_LIKE) { + } elseif ($operator->getType() === ISearchComparison::COMPARE_LIKE) { // transform "mimetype='foo/%'" to "mimepart='foo'" if (preg_match('|(.+)/%|', $value, $matches)) { $field = 'mimepart'; $value = (int)$this->mimetypeLoader->getId($matches[1]); $type = ISearchComparison::COMPARE_EQUAL; - } else if (strpos($value, '%') !== false) { + } elseif (strpos($value, '%') !== false) { throw new \InvalidArgumentException('Unsupported query value for mimetype: ' . $value . ', only values in the format "mime/type" or "mime/%" are supported'); } else { $field = 'mimetype'; @@ -157,12 +157,12 @@ class QuerySearchHelper { $type = ISearchComparison::COMPARE_EQUAL; } } - } else if ($field === 'favorite') { + } elseif ($field === 'favorite') { $field = 'tag.category'; $value = self::TAG_FAVORITE; - } else if ($field === 'tagname') { + } elseif ($field === 'tagname') { $field = 'tag.category'; - } else if ($field === 'fileid') { + } elseif ($field === 'fileid') { $field = 'file.fileid'; } return [$field, $value, $type]; diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index f2c998eeeed..87f32538ec7 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -412,7 +412,7 @@ class Scanner extends BasicEmitter implements IScanner { $childSize = $this->scanChildren($child, $recursive, $reuse, $childId, $lock); if ($childSize === -1) { $size = -1; - } else if ($size !== -1) { + } elseif ($size !== -1) { $size += $childSize; } } @@ -442,12 +442,12 @@ class Scanner extends BasicEmitter implements IScanner { if ($data) { if ($data['mimetype'] === 'httpd/unix-directory' and $recursive === self::SCAN_RECURSIVE) { $childQueue[$child] = $data['fileid']; - } else if ($data['mimetype'] === 'httpd/unix-directory' and $recursive === self::SCAN_RECURSIVE_INCOMPLETE and $data['size'] === -1) { + } elseif ($data['mimetype'] === 'httpd/unix-directory' and $recursive === self::SCAN_RECURSIVE_INCOMPLETE and $data['size'] === -1) { // only recurse into folders which aren't fully scanned $childQueue[$child] = $data['fileid']; - } else if ($data['size'] === -1) { + } elseif ($data['size'] === -1) { $size = -1; - } else if ($size !== -1) { + } elseif ($size !== -1) { $size += $data['size']; } } diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php index a77270329ad..8c30eeda2cf 100644 --- a/lib/private/Files/Cache/Wrapper/CacheJail.php +++ b/lib/private/Files/Cache/Wrapper/CacheJail.php @@ -75,7 +75,7 @@ class CacheJail extends CacheWrapper { $rootLength = strlen($this->getRoot()) + 1; if ($path === $this->getRoot()) { return ''; - } else if (substr($path, 0, $rootLength) === $this->getRoot() . '/') { + } elseif (substr($path, 0, $rootLength) === $this->getRoot() . '/') { return substr($path, $rootLength); } else { return null; diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php index cfc03ffd4e0..b73e11f84b8 100644 --- a/lib/private/Files/FileInfo.php +++ b/lib/private/Files/FileInfo.php @@ -119,11 +119,11 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { public function offsetGet($offset) { if ($offset === 'type') { return $this->getType(); - } else if ($offset === 'etag') { + } elseif ($offset === 'etag') { return $this->getEtag(); - } else if ($offset === 'size') { + } elseif ($offset === 'size') { return $this->getSize(); - } else if ($offset === 'mtime') { + } elseif ($offset === 'mtime') { return $this->getMTime(); } elseif ($offset === 'permissions') { return $this->getPermissions(); diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php index 44da2e6f20f..1999edf67fd 100644 --- a/lib/private/Files/Filesystem.php +++ b/lib/private/Files/Filesystem.php @@ -601,7 +601,7 @@ class Filesystem { static public function isBlacklisted($data) { if (isset($data['path'])) { $path = $data['path']; - } else if (isset($data['newpath'])) { + } elseif (isset($data['newpath'])) { $path = $data['newpath']; } if (isset($path)) { diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php index c005e4f7770..b24abf34f33 100644 --- a/lib/private/Files/Node/Folder.php +++ b/lib/private/Files/Node/Folder.php @@ -73,7 +73,7 @@ class Folder extends Node implements \OCP\Files\Folder { } if ($path === $this->path) { return '/'; - } else if (strpos($path, $this->path . '/') !== 0) { + } elseif (strpos($path, $this->path . '/') !== 0) { return null; } else { $path = substr($path, strlen($this->path)); @@ -521,7 +521,7 @@ class Folder extends Node implements \OCP\Files\Folder { $rootLength = strlen($jailRoot) + 1; if ($path === $jailRoot) { return $mount->getMountPoint(); - } else if (substr($path, 0, $rootLength) === $jailRoot . '/') { + } elseif (substr($path, 0, $rootLength) === $jailRoot . '/') { return $mount->getMountPoint() . substr($path, $rootLength); } else { return null; diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index 5dfd835fb94..7224f075d82 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -105,7 +105,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common { // something went wrong return false; } - } else if ($parentType === 'file') { + } elseif ($parentType === 'file') { // parent is a file return false; } diff --git a/lib/private/Files/ObjectStore/SwiftFactory.php b/lib/private/Files/ObjectStore/SwiftFactory.php index 93ff02f1f8b..c7d2e691bbd 100644 --- a/lib/private/Files/ObjectStore/SwiftFactory.php +++ b/lib/private/Files/ObjectStore/SwiftFactory.php @@ -158,7 +158,7 @@ class SwiftFactory { $token = $authService->generateTokenFromCache($cachedToken); if (\is_null($token->catalog)) { $this->logger->warning('Invalid cached token for swift, no catalog set: ' . json_encode($cachedToken)); - } else if ($token->hasExpired()) { + } elseif ($token->hasExpired()) { $this->logger->debug('Cached token for swift expired'); } else { $hasValidCachedToken = true; @@ -192,9 +192,9 @@ class SwiftFactory { $statusCode = $e->getResponse()->getStatusCode(); if ($statusCode === 404) { throw new StorageAuthException('Keystone not found, verify the keystone url', $e); - } else if ($statusCode === 412) { + } elseif ($statusCode === 412) { throw new StorageAuthException('Precondition failed, verify the keystone url', $e); - } else if ($statusCode === 401) { + } elseif ($statusCode === 401) { throw new StorageAuthException('Authentication failed, verify the username, password and possibly tenant', $e); } else { throw new StorageAuthException('Unknown error', $e); diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index f2d427227c9..456980db538 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -104,7 +104,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { protected function remove($path) { if ($this->is_dir($path)) { return $this->rmdir($path); - } else if ($this->is_file($path)) { + } elseif ($this->is_file($path)) { return $this->unlink($path); } else { return false; @@ -439,7 +439,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { foreach (explode('/', $path) as $chunk) { if ($chunk == '..') { array_pop($output); - } else if ($chunk == '.') { + } elseif ($chunk == '.') { } else { $output[] = $chunk; } diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index 3654ef1285c..3100a14a570 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -99,7 +99,7 @@ class DAV extends Common { $host = $params['host']; //remove leading http[s], will be generated in createBaseUri() if (substr($host, 0, 8) == "https://") $host = substr($host, 8); - else if (substr($host, 0, 7) == "http://") $host = substr($host, 7); + elseif (substr($host, 0, 7) == "http://") $host = substr($host, 7); $this->host = $host; $this->user = $params['user']; $this->password = $params['password']; @@ -320,7 +320,7 @@ class DAV extends Common { if ($cachedState === false) { // we know the file doesn't exist return false; - } else if (!is_null($cachedState)) { + } elseif (!is_null($cachedState)) { return true; } // need to get from server @@ -718,9 +718,9 @@ class DAV extends Common { } if (isset($response['{http://owncloud.org/ns}permissions'])) { return $this->parsePermissions($response['{http://owncloud.org/ns}permissions']); - } else if ($this->is_dir($path)) { + } elseif ($this->is_dir($path)) { return Constants::PERMISSION_ALL; - } else if ($this->file_exists($path)) { + } elseif ($this->file_exists($path)) { return Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE; } else { return 0; @@ -797,10 +797,10 @@ class DAV extends Common { } if (!empty($etag) && $cachedData['etag'] !== $etag) { return true; - } else if (isset($response['{http://open-collaboration-services.org/ns}share-permissions'])) { + } elseif (isset($response['{http://open-collaboration-services.org/ns}share-permissions'])) { $sharePermissions = (int)$response['{http://open-collaboration-services.org/ns}share-permissions']; return $sharePermissions !== $cachedData['permissions']; - } else if (isset($response['{http://owncloud.org/ns}permissions'])) { + } elseif (isset($response['{http://owncloud.org/ns}permissions'])) { $permissions = $this->parsePermissions($response['{http://owncloud.org/ns}permissions']); return $permissions !== $cachedData['permissions']; } else { @@ -850,22 +850,22 @@ class DAV extends Common { if ($e->getHttpStatus() === Http::STATUS_UNAUTHORIZED) { // either password was changed or was invalid all along throw new StorageInvalidException(get_class($e) . ': ' . $e->getMessage()); - } else if ($e->getHttpStatus() === Http::STATUS_METHOD_NOT_ALLOWED) { + } elseif ($e->getHttpStatus() === Http::STATUS_METHOD_NOT_ALLOWED) { // ignore exception for MethodNotAllowed, false will be returned return; - } else if ($e->getHttpStatus() === Http::STATUS_FORBIDDEN){ + } elseif ($e->getHttpStatus() === Http::STATUS_FORBIDDEN){ // The operation is forbidden. Fail somewhat gracefully throw new ForbiddenException(get_class($e) . ':' . $e->getMessage()); } throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); - } else if ($e instanceof ClientException) { + } elseif ($e instanceof ClientException) { // connection timeout or refused, server could be temporarily down throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); - } else if ($e instanceof \InvalidArgumentException) { + } elseif ($e instanceof \InvalidArgumentException) { // parse error because the server returned HTML instead of XML, // possibly temporarily down throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); - } else if (($e instanceof StorageNotAvailableException) || ($e instanceof StorageInvalidException)) { + } elseif (($e instanceof StorageNotAvailableException) || ($e instanceof StorageInvalidException)) { // rethrow throw $e; } diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index fbb84418e2e..05dd8c4d68f 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -112,9 +112,9 @@ class Local extends \OC\Files\Storage\Common { if (in_array($file->getBasename(), ['.', '..'])) { $it->next(); continue; - } else if ($file->isDir()) { + } elseif ($file->isDir()) { rmdir($file->getPathname()); - } else if ($file->isFile() || $file->isLink()) { + } elseif ($file->isFile() || $file->isLink()) { unlink($file->getPathname()); } $it->next(); @@ -275,7 +275,7 @@ class Local extends \OC\Files\Storage\Common { public function unlink($path) { if ($this->is_dir($path)) { return $this->rmdir($path); - } else if ($this->is_file($path)) { + } elseif ($this->is_file($path)) { return unlink($this->getSourcePath($path)); } else { return false; @@ -316,7 +316,7 @@ class Local extends \OC\Files\Storage\Common { if ($this->is_dir($path2)) { $this->rmdir($path2); - } else if ($this->is_file($path2)) { + } elseif ($this->is_file($path2)) { $this->unlink($path2); } diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index eb92f07d973..850b6205412 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -437,7 +437,7 @@ class Encryption extends Wrapper { if (!empty($encryptionModuleId)) { $encryptionModule = $this->encryptionManager->getEncryptionModule($encryptionModuleId); $shouldEncrypt = true; - } else if (empty($encryptionModuleId) && $info['encrypted'] === true) { + } elseif (empty($encryptionModuleId) && $info['encrypted'] === true) { // we come from a old installation. No header and/or no module defined // but the file is encrypted. In this case we need to use the // OC_DEFAULT_MODULE to read the file @@ -935,7 +935,7 @@ class Encryption extends Wrapper { if (!isset($result[Util::HEADER_ENCRYPTION_MODULE_KEY])) { if (!empty($result)) { $result[Util::HEADER_ENCRYPTION_MODULE_KEY] = 'OC_DEFAULT_MODULE'; - } else if ($exists) { + } elseif ($exists) { // if the header was empty we have to check first if it is a encrypted file at all // We would do query to filecache only if we know that entry in filecache exists $info = $this->getCache()->get($path); diff --git a/lib/private/Files/Stream/Quota.php b/lib/private/Files/Stream/Quota.php index 7d5337d3a7d..877a05e6aa9 100644 --- a/lib/private/Files/Stream/Quota.php +++ b/lib/private/Files/Stream/Quota.php @@ -77,7 +77,7 @@ class Quota extends Wrapper { $offset = $this->stream_tell() + $offset; $this->limit += $oldOffset - $offset; } - else if ($whence === SEEK_SET) { + elseif ($whence === SEEK_SET) { $this->limit += $this->stream_tell() - $offset; } else { $this->limit -= $offset; diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 881bf1a2126..da67fc461b5 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -824,7 +824,7 @@ class View { if ((Cache\Scanner::isPartialFile($path1) && !Cache\Scanner::isPartialFile($path2)) && $result !== false) { // if it was a rename from a part file to a regular file it was a write and not a rename operation $this->writeUpdate($storage2, $internalPath2); - } else if ($result) { + } elseif ($result) { if ($internalPath1 !== '') { // don't do a cache update for moved mounts $this->renameUpdate($storage1, $storage2, $internalPath1, $internalPath2); } @@ -1165,7 +1165,7 @@ class View { } catch (\Exception $e) { if (in_array('write', $hooks) || in_array('delete', $hooks)) { $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); - } else if (in_array('read', $hooks)) { + } elseif (in_array('read', $hooks)) { $this->unlockFile($path, ILockingProvider::LOCK_SHARED); } throw $e; @@ -1193,7 +1193,7 @@ class View { $result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) { if (in_array('write', $hooks)) { $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); - } else if (in_array('read', $hooks)) { + } elseif (in_array('read', $hooks)) { $this->unlockFile($path, ILockingProvider::LOCK_SHARED); } }); @@ -1340,7 +1340,7 @@ class View { $scanner = $storage->getScanner($internalPath); $scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW); $data = $cache->get($internalPath); - } else if (!Cache\Scanner::isPartialFile($internalPath) && $watcher->needsUpdate($internalPath, $data)) { + } elseif (!Cache\Scanner::isPartialFile($internalPath) && $watcher->needsUpdate($internalPath, $data)) { $this->lockFile($relativePath, ILockingProvider::LOCK_SHARED); $watcher->update($internalPath, $data); $storage->getPropagator()->propagateChange($internalPath, time()); diff --git a/lib/private/Group/Manager.php b/lib/private/Group/Manager.php index f0acacdd0c5..73c07a6197f 100644 --- a/lib/private/Group/Manager.php +++ b/lib/private/Group/Manager.php @@ -192,7 +192,7 @@ class Manager extends PublicEmitter implements IGroupManager { } $backends[] = $backend; } - } else if ($backend->groupExists($gid)) { + } elseif ($backend->groupExists($gid)) { $backends[] = $backend; } } @@ -218,7 +218,7 @@ class Manager extends PublicEmitter implements IGroupManager { public function createGroup($gid) { if ($gid === '' || $gid === null) { return null; - } else if ($group = $this->get($gid)) { + } elseif ($group = $this->get($gid)) { return $group; } else { $this->emit('\OC\Group', 'preCreate', [$gid]); diff --git a/lib/private/Group/MetaData.php b/lib/private/Group/MetaData.php index 3a2c08b0878..335bf43c16b 100644 --- a/lib/private/Group/MetaData.php +++ b/lib/private/Group/MetaData.php @@ -151,7 +151,7 @@ class MetaData { if ($this->sorting === self::SORT_USERCOUNT) { $sortKeys[$sortIndex] = $data['usercount']; $sortIndex++; - } else if ($this->sorting === self::SORT_GROUPNAME) { + } elseif ($this->sorting === self::SORT_GROUPNAME) { $sortKeys[$sortIndex] = $data['name']; $sortIndex++; } @@ -183,7 +183,7 @@ class MetaData { private function sort(&$entries, $sortKeys) { if ($this->sorting === self::SORT_USERCOUNT) { array_multisort($sortKeys, SORT_DESC, $entries); - } else if ($this->sorting === self::SORT_GROUPNAME) { + } elseif ($this->sorting === self::SORT_GROUPNAME) { array_multisort($sortKeys, SORT_ASC, $entries); } } diff --git a/lib/private/Http/CookieHelper.php b/lib/private/Http/CookieHelper.php index e895b8531cf..7d2acc7a193 100644 --- a/lib/private/Http/CookieHelper.php +++ b/lib/private/Http/CookieHelper.php @@ -68,7 +68,7 @@ class CookieHelper { if ($samesite === self::SAMESITE_LAX) { $header .= '; SameSite=Lax'; - } else if ($samesite === self::SAMESITE_STRICT) { + } elseif ($samesite === self::SAMESITE_STRICT) { $header .= '; SameSite=Strict'; } diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php index 5624155dadd..a5b208cfb3c 100644 --- a/lib/private/L10N/Factory.php +++ b/lib/private/L10N/Factory.php @@ -505,7 +505,7 @@ class Factory implements IFactory { if (file_exists($this->serverRoot . '/' . $app . '/l10n/')) { return $this->serverRoot . '/' . $app . '/l10n/'; } - } else if ($app && \OC_App::getAppPath($app) !== false) { + } elseif ($app && \OC_App::getAppPath($app) !== false) { // Check if the app is in the app folder return \OC_App::getAppPath($app) . '/l10n/'; } @@ -603,7 +603,7 @@ class Factory implements IFactory { 'code' => $lang, 'name' => $potentialName ]; - } else if ($lang === 'en') { + } elseif ($lang === 'en') { $ln = [ 'code' => $lang, 'name' => 'English (US)' diff --git a/lib/private/L10N/L10N.php b/lib/private/L10N/L10N.php index ee339ba8840..fc50e7a8b43 100644 --- a/lib/private/L10N/L10N.php +++ b/lib/private/L10N/L10N.php @@ -178,10 +178,10 @@ class L10N implements IL10N { $value = new \DateTime(); if ($data instanceof \DateTime) { $value = $data; - } else if (\is_string($data) && !is_numeric($data)) { + } elseif (\is_string($data) && !is_numeric($data)) { $data = strtotime($data); $value->setTimestamp($data); - } else if ($data !== null) { + } elseif ($data !== null) { $data = (int)$data; $value->setTimestamp($data); } diff --git a/lib/private/LargeFileHelper.php b/lib/private/LargeFileHelper.php index fb4ef1ce4f7..603fe7e461f 100755 --- a/lib/private/LargeFileHelper.php +++ b/lib/private/LargeFileHelper.php @@ -75,9 +75,9 @@ class LargeFileHelper { if (is_float($number)) { // Undo the effect of the php.ini setting 'precision'. return number_format($number, 0, '', ''); - } else if (is_string($number) && ctype_digit($number)) { + } elseif (is_string($number) && ctype_digit($number)) { return $number; - } else if (is_int($number)) { + } elseif (is_int($number)) { // Interpret signed integer as unsigned integer. return sprintf('%u', $number); } else { @@ -151,7 +151,7 @@ class LargeFileHelper { $result = null; if (strpos($os, 'linux') !== false) { $result = $this->exec("stat -c %s $arg"); - } else if (strpos($os, 'bsd') !== false || strpos($os, 'darwin') !== false) { + } elseif (strpos($os, 'bsd') !== false || strpos($os, 'darwin') !== false) { $result = $this->exec("stat -f %z $arg"); } return $result; diff --git a/lib/private/Lock/AbstractLockingProvider.php b/lib/private/Lock/AbstractLockingProvider.php index 91870325fe2..81d949d2a06 100644 --- a/lib/private/Lock/AbstractLockingProvider.php +++ b/lib/private/Lock/AbstractLockingProvider.php @@ -87,7 +87,7 @@ abstract class AbstractLockingProvider implements ILockingProvider { unset($this->acquiredLocks['shared'][$path]); } } - } else if ($type === self::LOCK_EXCLUSIVE) { + } elseif ($type === self::LOCK_EXCLUSIVE) { unset($this->acquiredLocks['exclusive'][$path]); } } @@ -105,7 +105,7 @@ abstract class AbstractLockingProvider implements ILockingProvider { $this->acquiredLocks['shared'][$path] = 0; } $this->acquiredLocks['shared'][$path]++; - } else if ($targetType === self::LOCK_EXCLUSIVE) { + } elseif ($targetType === self::LOCK_EXCLUSIVE) { $this->acquiredLocks['exclusive'][$path] = true; $this->acquiredLocks['shared'][$path]--; } diff --git a/lib/private/Lock/DBLockingProvider.php b/lib/private/Lock/DBLockingProvider.php index a8c22b59cb1..d68535e3e9b 100644 --- a/lib/private/Lock/DBLockingProvider.php +++ b/lib/private/Lock/DBLockingProvider.php @@ -98,7 +98,7 @@ class DBLockingProvider extends AbstractLockingProvider { if ($this->cacheSharedLocks) { if ($targetType === self::LOCK_SHARED) { $this->sharedLocks[$path] = true; - } else if ($targetType === self::LOCK_EXCLUSIVE) { + } elseif ($targetType === self::LOCK_EXCLUSIVE) { $this->sharedLocks[$path] = false; } } @@ -167,7 +167,7 @@ class DBLockingProvider extends AbstractLockingProvider { } else { return $lockValue > 0; } - } else if ($type === self::LOCK_EXCLUSIVE) { + } elseif ($type === self::LOCK_EXCLUSIVE) { return $lockValue === -1; } else { return false; @@ -227,7 +227,7 @@ class DBLockingProvider extends AbstractLockingProvider { 'UPDATE `*PREFIX*file_locks` SET `lock` = 0 WHERE `key` = ? AND `lock` = -1', [$path] ); - } else if (!$this->cacheSharedLocks) { + } elseif (!$this->cacheSharedLocks) { $query = $this->connection->getQueryBuilder(); $query->update('file_locks') ->set('lock', $query->func()->subtract('lock', $query->createNamedParameter(1))) diff --git a/lib/private/Lock/MemcacheLockingProvider.php b/lib/private/Lock/MemcacheLockingProvider.php index 6cab64b3a02..2c2d8a95938 100644 --- a/lib/private/Lock/MemcacheLockingProvider.php +++ b/lib/private/Lock/MemcacheLockingProvider.php @@ -60,7 +60,7 @@ class MemcacheLockingProvider extends AbstractLockingProvider { $lockValue = $this->memcache->get($path); if ($type === self::LOCK_SHARED) { return $lockValue > 0; - } else if ($type === self::LOCK_EXCLUSIVE) { + } elseif ($type === self::LOCK_EXCLUSIVE) { return $lockValue === 'exclusive'; } else { return false; @@ -108,7 +108,7 @@ class MemcacheLockingProvider extends AbstractLockingProvider { if ($newValue < 0) { $this->memcache->cad($path, $newValue); } - } else if ($type === self::LOCK_EXCLUSIVE) { + } elseif ($type === self::LOCK_EXCLUSIVE) { $this->memcache->cad($path, 'exclusive'); } $this->markRelease($path, $type); @@ -126,7 +126,7 @@ class MemcacheLockingProvider extends AbstractLockingProvider { if (!$this->memcache->cas($path, 'exclusive', 1)) { throw new LockedException($path, null, $this->getExistingLockForException($path)); } - } else if ($targetType === self::LOCK_EXCLUSIVE) { + } elseif ($targetType === self::LOCK_EXCLUSIVE) { // we can only change a shared lock to an exclusive if there's only a single owner of the shared lock if (!$this->memcache->cas($path, 1, 'exclusive')) { throw new LockedException($path, null, $this->getExistingLockForException($path)); @@ -140,7 +140,7 @@ class MemcacheLockingProvider extends AbstractLockingProvider { $existing = $this->memcache->get($path); if (!$existing) { return 'none'; - } else if ($existing === 'exclusive') { + } elseif ($existing === 'exclusive') { return $existing; } else { return $existing . ' shared locks'; diff --git a/lib/private/Log/ExceptionSerializer.php b/lib/private/Log/ExceptionSerializer.php index 4ec35b95673..50544d7149c 100644 --- a/lib/private/Log/ExceptionSerializer.php +++ b/lib/private/Log/ExceptionSerializer.php @@ -132,7 +132,7 @@ class ExceptionSerializer { foreach ($args as &$arg) { if (in_array($arg, $values, true)) { $arg = '*** sensitive parameter replaced ***'; - } else if (is_array($arg)) { + } elseif (is_array($arg)) { $arg = $this->removeValuesFromArgs($arg, $values); } } @@ -154,7 +154,7 @@ class ExceptionSerializer { $data = get_object_vars($arg); $data['__class__'] = get_class($arg); return array_map([$this, 'encodeArg'], $data); - } else if (is_array($arg)) { + } elseif (is_array($arg)) { return array_map([$this, 'encodeArg'], $arg); } else { return $arg; diff --git a/lib/private/MemoryInfo.php b/lib/private/MemoryInfo.php index 26f0d6a2869..37bf98fef59 100644 --- a/lib/private/MemoryInfo.php +++ b/lib/private/MemoryInfo.php @@ -52,7 +52,7 @@ class MemoryInfo { $iniValue = trim(ini_get('memory_limit')); if ($iniValue === '-1') { return -1; - } else if (is_numeric($iniValue) === true) { + } elseif (is_numeric($iniValue) === true) { return (int)$iniValue; } else { return $this->memoryLimitToBytes($iniValue); diff --git a/lib/private/NavigationManager.php b/lib/private/NavigationManager.php index 8d72040af9a..b71e194398f 100644 --- a/lib/private/NavigationManager.php +++ b/lib/private/NavigationManager.php @@ -138,7 +138,7 @@ class NavigationManager implements INavigationManager { uasort($list, function ($a, $b) { if (isset($a['order']) && isset($b['order'])) { return ($a['order'] < $b['order']) ? -1 : 1; - } else if (isset($a['order']) || isset($b['order'])) { + } elseif (isset($a['order']) || isset($b['order'])) { return isset($a['order']) ? -1 : 1; } else { return ($a['name'] < $b['name']) ? -1 : 1; diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index 4ee8518981c..f945849c276 100644 --- a/lib/private/Preview/Generator.php +++ b/lib/private/Preview/Generator.php @@ -297,7 +297,7 @@ class Generator { } else { $width = $height / $ratio; } - } else if ($mode === IPreview::MODE_COVER) { + } elseif ($mode === IPreview::MODE_COVER) { if ($ratioH > $ratioW) { $width = $height / $ratio; } else { diff --git a/lib/private/RedisFactory.php b/lib/private/RedisFactory.php index 3144a006d8b..9aa822c40c8 100644 --- a/lib/private/RedisFactory.php +++ b/lib/private/RedisFactory.php @@ -78,7 +78,7 @@ class RedisFactory { } if (isset($config['port'])) { $port = $config['port']; - } else if ($host[0] !== '/') { + } elseif ($host[0] !== '/') { $port = 6379; } else { $port = null; diff --git a/lib/private/Remote/Api/OCS.php b/lib/private/Remote/Api/OCS.php index 6a32c83e086..1ebf1e4a0df 100644 --- a/lib/private/Remote/Api/OCS.php +++ b/lib/private/Remote/Api/OCS.php @@ -48,7 +48,7 @@ class OCS extends ApiBase implements ICapabilitiesApi, IUserApi { } catch (ClientException $e) { if ($e->getResponse()->getStatusCode() === 404) { throw new NotFoundException(); - } else if ($e->getResponse()->getStatusCode() === 403 || $e->getResponse()->getStatusCode() === 401) { + } elseif ($e->getResponse()->getStatusCode() === 403 || $e->getResponse()->getStatusCode() === 401) { throw new ForbiddenException(); } else { throw $e; diff --git a/lib/private/Repair/Owncloud/SaveAccountsTableData.php b/lib/private/Repair/Owncloud/SaveAccountsTableData.php index 171683e8f9b..12515f2e882 100644 --- a/lib/private/Repair/Owncloud/SaveAccountsTableData.php +++ b/lib/private/Repair/Owncloud/SaveAccountsTableData.php @@ -177,7 +177,7 @@ class SaveAccountsTableData implements IRepairStep { } if ($state === 1) { $this->config->setUserValue($userdata['user_id'], 'core', 'enabled', 'true'); - } else if ($state === 2) { + } elseif ($state === 2) { $this->config->setUserValue($userdata['user_id'], 'core', 'enabled', 'false'); } diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php index 5b73a1f697e..b125fd60164 100644 --- a/lib/private/Route/Router.php +++ b/lib/private/Route/Router.php @@ -251,16 +251,16 @@ class Router implements IRouter { $app = \OC_App::cleanAppId($app); \OC::$REQUESTEDAPP = $app; $this->loadRoutes($app); - } else if (substr($url, 0, 13) === '/ocsapp/apps/') { + } elseif (substr($url, 0, 13) === '/ocsapp/apps/') { // empty string / 'ocsapp' / 'apps' / $app / rest of the route list(, , , $app,) = explode('/', $url, 5); $app = \OC_App::cleanAppId($app); \OC::$REQUESTEDAPP = $app; $this->loadRoutes($app); - } else if (substr($url, 0, 10) === '/settings/') { + } elseif (substr($url, 0, 10) === '/settings/') { $this->loadRoutes('settings'); - } else if (substr($url, 0, 6) === '/core/') { + } elseif (substr($url, 0, 6) === '/core/') { \OC::$REQUESTEDAPP = $url; if (!\OC::$server->getConfig()->getSystemValueBool('maintenance') && !Util::needUpgrade()) { \OC_App::loadApps(); diff --git a/lib/private/Search.php b/lib/private/Search.php index 42a925f90d9..f58822d68f6 100644 --- a/lib/private/Search.php +++ b/lib/private/Search.php @@ -58,7 +58,7 @@ class Search implements ISearch { } if ($provider instanceof PagedProvider) { $results = array_merge($results, $provider->searchPaged($query, $page, $size)); - } else if ($provider instanceof Provider) { + } elseif ($provider instanceof Provider) { $providerResults = $provider->search($query); if ($size > 0) { $slicedResults = array_slice($providerResults, ($page - 1) * $size, $size); diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php index 8e58e9bde9a..d8e06032ef1 100644 --- a/lib/private/Security/Bruteforce/Throttler.php +++ b/lib/private/Security/Bruteforce/Throttler.php @@ -151,7 +151,7 @@ class Throttler { if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { $type = 4; - } else if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { + } elseif (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { $type = 6; } else { return false; diff --git a/lib/private/ServerContainer.php b/lib/private/ServerContainer.php index 13fb70ddd44..effa57a3abf 100644 --- a/lib/private/ServerContainer.php +++ b/lib/private/ServerContainer.php @@ -135,7 +135,7 @@ class ServerContainer extends SimpleContainer { // Didn't find the service or the respective app container, // ignore it and fall back to the core container. } - } else if (strpos($name, 'OC\\Settings\\') === 0 && substr_count($name, '\\') >= 3) { + } elseif (strpos($name, 'OC\\Settings\\') === 0 && substr_count($name, '\\') >= 3) { $segments = explode('\\', $name); try { $appContainer = $this->getAppContainer(strtolower($segments[1]), $segments[1]); diff --git a/lib/private/Setup/AbstractDatabase.php b/lib/private/Setup/AbstractDatabase.php index db6b182be63..d509a6b8722 100644 --- a/lib/private/Setup/AbstractDatabase.php +++ b/lib/private/Setup/AbstractDatabase.php @@ -71,9 +71,9 @@ abstract class AbstractDatabase { $errors = []; if(empty($config['dbuser']) && empty($config['dbname'])) { $errors[] = $this->trans->t("%s enter the database username and name.", [$this->dbprettyname]); - } else if(empty($config['dbuser'])) { + } elseif(empty($config['dbuser'])) { $errors[] = $this->trans->t("%s enter the database username.", [$this->dbprettyname]); - } else if(empty($config['dbname'])) { + } elseif(empty($config['dbname'])) { $errors[] = $this->trans->t("%s enter the database name.", [$this->dbprettyname]); } if(substr_count($config['dbname'], '.') >= 1) { @@ -125,7 +125,7 @@ abstract class AbstractDatabase { } else { $connectionParams['unix_socket'] = $this->dbPort; } - } else if (strpos($this->dbHost, ':')) { + } elseif (strpos($this->dbHost, ':')) { // Host variable may carry a port or socket. list($host, $portOrSocket) = explode(':', $this->dbHost, 2); if (ctype_digit($portOrSocket)) { diff --git a/lib/private/Setup/OCI.php b/lib/private/Setup/OCI.php index ab00c8a47b2..1d7fe27e8b8 100644 --- a/lib/private/Setup/OCI.php +++ b/lib/private/Setup/OCI.php @@ -55,9 +55,9 @@ class OCI extends AbstractDatabase { $errors = []; if (empty($config['dbuser']) && empty($config['dbname'])) { $errors[] = $this->trans->t("%s enter the database username and name.", [$this->dbprettyname]); - } else if (empty($config['dbuser'])) { + } elseif (empty($config['dbuser'])) { $errors[] = $this->trans->t("%s enter the database username.", [$this->dbprettyname]); - } else if (empty($config['dbname'])) { + } elseif (empty($config['dbname'])) { $errors[] = $this->trans->t("%s enter the database name.", [$this->dbprettyname]); } return $errors; diff --git a/lib/private/Share/Helper.php b/lib/private/Share/Helper.php index 1574bd726cf..a3b8da44c4c 100644 --- a/lib/private/Share/Helper.php +++ b/lib/private/Share/Helper.php @@ -213,7 +213,7 @@ class Helper extends \OC\Share\Constants { } else { $expires = $userExpireDate; } - } else if ($defaultExpires && !empty($defaultExpireSettings['enforceExpireDate'])) { + } elseif ($defaultExpires && !empty($defaultExpireSettings['enforceExpireDate'])) { $expires = $defaultExpires; } diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php index 9b74239d69d..319bd5bec38 100644 --- a/lib/private/Share/Share.php +++ b/lib/private/Share/Share.php @@ -356,7 +356,7 @@ class Share extends Constants { // if there is more then one result we don't have to delete the children // but update their parent. For group shares the new parent should always be // the original group share and not the db entry with the unique name - } else if ((int)$item['share_type'] === self::$shareTypeGroupUserUnique) { + } elseif ((int)$item['share_type'] === self::$shareTypeGroupUserUnique) { $newParent = $item['parent']; } else { $newParent = $item['id']; @@ -457,7 +457,7 @@ class Share extends Constants { $l = \OC::$server->getL10N('lib'); if (isset(self::$backends[$itemType])) { return self::$backends[$itemType]; - } else if (isset(self::$backendTypes[$itemType]['class'])) { + } elseif (isset(self::$backendTypes[$itemType]['class'])) { $class = self::$backendTypes[$itemType]['class']; if (class_exists($class)) { self::$backends[$itemType] = new $class; @@ -778,7 +778,7 @@ class Share extends Constants { if ($row['permissions'] == 0) { continue; } - } else if (!isset($uidOwner)) { + } elseif (!isset($uidOwner)) { // Check if the same target already exists if (isset($targets[$row['id']])) { // Check if the same owner shared with the user twice @@ -858,7 +858,7 @@ class Share extends Constants { $row['share_type'] === self::SHARE_TYPE_USER) { $shareWithUser = \OC::$server->getUserManager()->get($row['share_with']); $row['share_with_displayname'] = $shareWithUser === null ? $row['share_with'] : $shareWithUser->getDisplayName(); - } else if(isset($row['share_with']) && $row['share_with'] != '' && + } elseif(isset($row['share_with']) && $row['share_with'] != '' && $row['share_type'] === self::SHARE_TYPE_REMOTE) { $addressBookEntries = \OC::$server->getContactsManager()->search($row['share_with'], ['CLOUD']); foreach ($addressBookEntries as $entry) { @@ -1417,7 +1417,7 @@ class Share extends Constants { private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE , $parameters = null) { if ($format === self::FORMAT_NONE) { return $items; - } else if ($format === self::FORMAT_STATUSES) { + } elseif ($format === self::FORMAT_STATUSES) { $statuses = []; foreach ($items as $item) { if ($item['share_type'] === self::SHARE_TYPE_LINK) { @@ -1425,7 +1425,7 @@ class Share extends Constants { continue; } $statuses[$item[$column]]['link'] = true; - } else if (!isset($statuses[$item[$column]])) { + } elseif (!isset($statuses[$item[$column]])) { $statuses[$item[$column]]['link'] = false; } if (!empty($item['file_target'])) { @@ -1447,7 +1447,7 @@ class Share extends Constants { public static 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/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 1c0ec194528..ad002a1fc96 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -152,7 +152,7 @@ class DefaultShareProvider implements IShareProvider { if ($share->getExpirationDate() !== null) { $qb->setValue('expiration', $qb->createNamedParameter($share->getExpirationDate(), 'datetime')); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { //Set the GID of the group we share with $qb->setValue('share_with', $qb->createNamedParameter($share->getSharedWith())); @@ -160,7 +160,7 @@ class DefaultShareProvider implements IShareProvider { if ($share->getExpirationDate() !== null) { $qb->setValue('expiration', $qb->createNamedParameter($share->getExpirationDate(), 'datetime')); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { //set label for public link $qb->setValue('label', $qb->createNamedParameter($share->getLabel())); //Set the token of the share @@ -269,7 +269,7 @@ class DefaultShareProvider implements IShareProvider { ->set('note', $qb->createNamedParameter($share->getNote())) ->set('accepted', $qb->createNamedParameter($share->getStatus())) ->execute(); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { $qb = $this->dbConn->getQueryBuilder(); $qb->update('share') ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) @@ -307,7 +307,7 @@ class DefaultShareProvider implements IShareProvider { ->set('permissions', $qb->createNamedParameter($share->getPermissions())) ->execute(); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { $qb = $this->dbConn->getQueryBuilder(); $qb->update('share') ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) @@ -381,7 +381,7 @@ class DefaultShareProvider implements IShareProvider { $id = $data['id']; } - } else if ($share->getShareType() === IShare::TYPE_USER) { + } elseif ($share->getShareType() === IShare::TYPE_USER) { if ($share->getSharedWith() !== $recipient) { throw new ProviderException('Recipient does not match'); } @@ -519,7 +519,7 @@ class DefaultShareProvider implements IShareProvider { ->execute(); } - } else if ($share->getShareType() === IShare::TYPE_USER) { + } elseif ($share->getShareType() === IShare::TYPE_USER) { if ($share->getSharedWith() !== $recipient) { throw new ProviderException('Recipient does not match'); @@ -601,7 +601,7 @@ class DefaultShareProvider implements IShareProvider { ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) ->execute(); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { // Check if there is a usergroup share $qb = $this->dbConn->getQueryBuilder(); @@ -894,7 +894,7 @@ class DefaultShareProvider implements IShareProvider { } $cursor->closeCursor(); - } else if ($shareType === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_GROUP) { $user = $this->userManager->get($userId); $allGroups = $this->groupManager->getUserGroups($user); @@ -1035,9 +1035,9 @@ class DefaultShareProvider implements IShareProvider { if ($user !== null) { $share->setSharedWithDisplayName($user->getDisplayName()); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { $share->setSharedWith($data['share_with']); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { $share->setPassword($data['password']); $share->setSendPasswordByTalk((bool)$data['password_by_talk']); $share->setToken($data['token']); @@ -1152,7 +1152,7 @@ class DefaultShareProvider implements IShareProvider { $qb->expr()->eq('share_with', $qb->createNamedParameter($uid)) ) ); - } else if ($shareType === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_GROUP) { /* * Delete all group shares that are owned by this user * Or special user group shares that are received by this user @@ -1173,7 +1173,7 @@ class DefaultShareProvider implements IShareProvider { $qb->expr()->eq('share_with', $qb->createNamedParameter($uid)) ) ); - } else if ($shareType === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_LINK) { /* * Delete all link shares owned by this user. * And all link shares initiated by this user (until #22327 is in) @@ -1316,7 +1316,7 @@ class DefaultShareProvider implements IShareProvider { $uid = $row['share_with']; $users[$uid] = isset($users[$uid]) ? $users[$uid] : []; $users[$uid][$row['id']] = $row; - } else if ($type === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($type === \OCP\Share::SHARE_TYPE_GROUP) { $gid = $row['share_with']; $group = $this->groupManager->get($gid); @@ -1330,9 +1330,9 @@ class DefaultShareProvider implements IShareProvider { $users[$uid] = isset($users[$uid]) ? $users[$uid] : []; $users[$uid][$row['id']] = $row; } - } else if ($type === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($type === \OCP\Share::SHARE_TYPE_LINK) { $link = true; - } else if ($type === self::SHARE_TYPE_USERGROUP && $currentAccess === true) { + } elseif ($type === self::SHARE_TYPE_USERGROUP && $currentAccess === true) { $uid = $row['share_with']; $users[$uid] = isset($users[$uid]) ? $users[$uid] : []; $users[$uid][$row['id']] = $row; @@ -1396,7 +1396,7 @@ class DefaultShareProvider implements IShareProvider { if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) { $user = $this->userManager->get($share->getSharedWith()); $this->sendNote([$user], $share); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { $group = $this->groupManager->get($share->getSharedWith()); $groupMembers = $group->getUsers(); $this->sendNote($groupMembers, $share); diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index c56db22c883..7ec678b07fb 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -221,33 +221,33 @@ class Manager implements IManager { if (!$this->userManager->userExists($share->getSharedWith())) { throw new \InvalidArgumentException('SharedWith is not a valid user'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { // We expect a valid group as sharedWith for group shares if (!$this->groupManager->groupExists($share->getSharedWith())) { throw new \InvalidArgumentException('SharedWith is not a valid group'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { if ($share->getSharedWith() !== null) { throw new \InvalidArgumentException('SharedWith should be empty'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE) { if ($share->getSharedWith() === null) { throw new \InvalidArgumentException('SharedWith should not be empty'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { if ($share->getSharedWith() === null) { throw new \InvalidArgumentException('SharedWith should not be empty'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { if ($share->getSharedWith() === null) { throw new \InvalidArgumentException('SharedWith should not be empty'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_CIRCLE) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_CIRCLE) { $circle = \OCA\Circles\Api\v1\Circles::detailsCircle($share->getSharedWith()); if ($circle === null) { throw new \InvalidArgumentException('SharedWith is not a valid circle'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_ROOM) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_ROOM) { } else { // We can't handle other types yet throw new \InvalidArgumentException('unknown share type'); @@ -721,13 +721,13 @@ class Manager implements IManager { //Verify the expiration date $share = $this->validateExpirationDateInternal($share); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { $this->groupCreateChecks($share); //Verify the expiration date $share = $this->validateExpirationDateInternal($share); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { $this->linkCreateChecks($share); $this->setLinkParent($share); @@ -751,7 +751,7 @@ class Manager implements IManager { if ($share->getPassword() !== null) { $share->setPassword($this->hasher->hash($share->getPassword())); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { $share->setToken( $this->secureRandom->generate( \OC\Share\Constants::TOKEN_LENGTH, @@ -952,7 +952,7 @@ class Manager implements IManager { $this->validateExpirationDate($share); $expirationDateUpdated = true; } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { $this->groupCreateChecks($share); if ($share->getExpirationDate() != $originalShare->getExpirationDate()) { @@ -960,7 +960,7 @@ class Manager implements IManager { $this->validateExpirationDate($share); $expirationDateUpdated = true; } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { $this->linkCreateChecks($share); $this->updateSharePasswordIfNeeded($share, $originalShare); @@ -970,7 +970,7 @@ class Manager implements IManager { $this->validateExpirationDate($share); $expirationDateUpdated = true; } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { // The new password is not set again if it is the same as the old // one, unless when switching from sending by Talk to sending by // mail. diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php index cdfd40c8703..cf23779a8b9 100644 --- a/lib/private/Share20/ProviderFactory.php +++ b/lib/private/Share20/ProviderFactory.php @@ -257,13 +257,13 @@ class ProviderFactory implements IProviderFactory { $provider = null; if ($id === 'ocinternal') { $provider = $this->defaultShareProvider(); - } else if ($id === 'ocFederatedSharing') { + } elseif ($id === 'ocFederatedSharing') { $provider = $this->federatedShareProvider(); - } else if ($id === 'ocMailShare') { + } elseif ($id === 'ocMailShare') { $provider = $this->getShareByMailProvider(); - } else if ($id === 'ocCircleShare') { + } elseif ($id === 'ocCircleShare') { $provider = $this->getShareByCircleProvider(); - } else if ($id === 'ocRoomShare') { + } elseif ($id === 'ocRoomShare') { $provider = $this->getRoomShareProvider(); } @@ -285,13 +285,13 @@ class ProviderFactory implements IProviderFactory { $shareType === \OCP\Share::SHARE_TYPE_LINK ) { $provider = $this->defaultShareProvider(); - } else if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE || $shareType === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_REMOTE || $shareType === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { $provider = $this->federatedShareProvider(); - } else if ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) { $provider = $this->getShareByMailProvider(); - } else if ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) { $provider = $this->getShareByCircleProvider(); - } else if ($shareType === \OCP\Share::SHARE_TYPE_ROOM) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_ROOM) { $provider = $this->getRoomShareProvider(); } diff --git a/lib/private/Streamer.php b/lib/private/Streamer.php index 47348447e6d..7ae03532a83 100644 --- a/lib/private/Streamer.php +++ b/lib/private/Streamer.php @@ -78,7 +78,7 @@ class Streamer { */ if ($size < 4 * 1000 * 1000 * 1000 && $numberOfFiles < 65536) { $this->streamerInstance = new ZipStreamer(['zip64' => false]); - } else if ($request->isUserAgent($this->preferTarFor)) { + } elseif ($request->isUserAgent($this->preferTarFor)) { $this->streamerInstance = new TarStreamer(); } else { $this->streamerInstance = new ZipStreamer(['zip64' => PHP_INT_SIZE !== 4]); diff --git a/lib/private/SystemTag/SystemTagObjectMapper.php b/lib/private/SystemTag/SystemTagObjectMapper.php index 179e16f8e17..e9df865ee96 100644 --- a/lib/private/SystemTag/SystemTagObjectMapper.php +++ b/lib/private/SystemTag/SystemTagObjectMapper.php @@ -69,7 +69,7 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper { public function getTagIdsForObjects($objIds, string $objectType): array { if (!\is_array($objIds)) { $objIds = [$objIds]; - } else if (empty($objIds)) { + } elseif (empty($objIds)) { return []; } diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php index 781cb0d7794..24573d71fe0 100644 --- a/lib/private/Template/JSConfigHelper.php +++ b/lib/private/Template/JSConfigHelper.php @@ -121,7 +121,7 @@ class JSConfigHelper { $backend = $this->currentUser->getBackend(); if ($backend instanceof IPasswordConfirmationBackend) { $userBackendAllowsPasswordConfirmation = $backend->canConfirmPassword($uid); - } else if (isset($this->excludedUserBackEnds[$this->currentUser->getBackendClassName()])) { + } elseif (isset($this->excludedUserBackEnds[$this->currentUser->getBackendClassName()])) { $userBackendAllowsPasswordConfirmation = false; } } else { diff --git a/lib/private/Template/JSResourceLocator.php b/lib/private/Template/JSResourceLocator.php index 93fbbf7d55d..0b6cf4e306e 100644 --- a/lib/private/Template/JSResourceLocator.php +++ b/lib/private/Template/JSResourceLocator.php @@ -62,7 +62,7 @@ class JSResourceLocator extends ResourceLocator { if ($found) { return; } - } else if ($this->appendIfExist($this->serverroot, $theme_dir.'apps/'.$script.'.js') + } elseif ($this->appendIfExist($this->serverroot, $theme_dir.'apps/'.$script.'.js') || $this->appendIfExist($this->serverroot, $theme_dir.$script.'.js') || $this->appendIfExist($this->serverroot, $script.'.js') || $this->cacheAndAppendCombineJsonIfExist($this->serverroot, $script.'.json') diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index 968ae7fceb8..cdab4c25693 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -124,12 +124,12 @@ class TemplateLayout extends \OC_Template { $this->assign('themingInvertMenu', false); } - } else if ($renderAs === 'error') { + } elseif ($renderAs === 'error') { parent::__construct('core', 'layout.guest', '', false); $this->assign('bodyid', 'body-login'); $this->assign('user_displayname', ''); $this->assign('user_uid', ''); - } else if ($renderAs === 'guest') { + } elseif ($renderAs === 'guest') { parent::__construct('core', 'layout.guest'); \OC_Util::addStyle('guest'); $this->assign('bodyid', 'body-login'); @@ -137,7 +137,7 @@ class TemplateLayout extends \OC_Template { $userDisplayName = \OC_User::getDisplayName(); $this->assign('user_displayname', $userDisplayName); $this->assign('user_uid', \OC_User::getUser()); - } else if ($renderAs === 'public') { + } elseif ($renderAs === 'public') { parent::__construct('core', 'layout.public'); $this->assign('appid', $appId); $this->assign('bodyid', 'body-public'); diff --git a/lib/private/Updater/ChangesCheck.php b/lib/private/Updater/ChangesCheck.php index 138e3bed9c3..2dd18467cd9 100644 --- a/lib/private/Updater/ChangesCheck.php +++ b/lib/private/Updater/ChangesCheck.php @@ -98,9 +98,9 @@ class ChangesCheck { protected function evaluateResponse(IResponse $response): int { if($response->getStatusCode() === 304) { return self::RESPONSE_USE_CACHE; - } else if($response->getStatusCode() === 404) { + } elseif($response->getStatusCode() === 404) { return self::RESPONSE_NO_CONTENT; - } else if($response->getStatusCode() === 200) { + } elseif($response->getStatusCode() === 200) { return self::RESPONSE_HAS_CONTENT; } $this->logger->debug('Unexpected return code {code} from changelog server', [ diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index 7b129a393e3..d908a3d78b2 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -480,7 +480,7 @@ class Session implements IUserSession, Emitter { if ($isTokenPassword) { $this->session->set('app_password', $password); - } else if($this->supportsCookies($request)) { + } elseif($this->supportsCookies($request)) { // Password login, but cookies supported -> create (browser) session token $this->createSessionToken($request, $this->getUser()->getUID(), $user, $password); } diff --git a/lib/private/User/User.php b/lib/private/User/User.php index bc492a6df29..6bd86bbc516 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -460,7 +460,7 @@ class User implements IUser { private 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/lib/private/legacy/OC_API.php b/lib/private/legacy/OC_API.php index 47590a00910..b9960c70777 100644 --- a/lib/private/legacy/OC_API.php +++ b/lib/private/legacy/OC_API.php @@ -85,7 +85,7 @@ class OC_API { if ($k[0] === '@') { $writer->writeAttribute(substr($k, 1), $v); continue; - } else if (is_numeric($k)) { + } elseif (is_numeric($k)) { $k = 'element'; } if(is_array($v)) { diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index 996b7a885c6..3cc194cc03d 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -216,7 +216,7 @@ class OC_App { 'class' => $plugin['@value'], ]; \OC::$server->getCollaboratorSearch()->registerPlugin($pluginInfo); - } else if ($plugin['@attributes']['type'] === 'autocomplete-sort') { + } elseif ($plugin['@attributes']['type'] === 'autocomplete-sort') { \OC::$server->getAutoCompleteManager()->registerSorter($plugin['@value']); } } @@ -733,7 +733,7 @@ class OC_App { $info['groups'] = null; if ($enabled === 'yes') { $active = true; - } else if ($enabled === 'no') { + } elseif ($enabled === 'no') { $active = false; } else { $active = true; @@ -847,9 +847,9 @@ class OC_App { $requireMin = $appInfo['dependencies']['nextcloud']['@attributes']['min-version']; } elseif (isset($appInfo['dependencies']['owncloud']['@attributes']['min-version'])) { $requireMin = $appInfo['dependencies']['owncloud']['@attributes']['min-version']; - } else if (isset($appInfo['requiremin'])) { + } elseif (isset($appInfo['requiremin'])) { $requireMin = $appInfo['requiremin']; - } else if (isset($appInfo['require'])) { + } elseif (isset($appInfo['require'])) { $requireMin = $appInfo['require']; } @@ -857,7 +857,7 @@ class OC_App { $requireMax = $appInfo['dependencies']['nextcloud']['@attributes']['max-version']; } elseif (isset($appInfo['dependencies']['owncloud']['@attributes']['max-version'])) { $requireMax = $appInfo['dependencies']['owncloud']['@attributes']['max-version']; - } else if (isset($appInfo['requiremax'])) { + } elseif (isset($appInfo['requiremax'])) { $requireMax = $appInfo['requiremax']; } @@ -1055,7 +1055,7 @@ class OC_App { if ($attributeLang === $similarLang) { $similarLangFallback = $option['@value']; - } else if (strpos($attributeLang, $similarLang . '_') === 0) { + } elseif (strpos($attributeLang, $similarLang . '_') === 0) { if ($similarLangFallback === false) { $similarLangFallback = $option['@value']; } @@ -1067,7 +1067,7 @@ class OC_App { if ($similarLangFallback !== false) { return $similarLangFallback; - } else if ($englishFallback !== false) { + } elseif ($englishFallback !== false) { return $englishFallback; } return (string) $fallback; @@ -1090,7 +1090,7 @@ class OC_App { } if ($lang && isset($data['description']) && is_array($data['description'])) { $data['description'] = trim(self::findBestL10NOption($data['description'], $lang)); - } else if (isset($data['description']) && is_string($data['description'])) { + } elseif (isset($data['description']) && is_string($data['description'])) { $data['description'] = trim($data['description']); } else { $data['description'] = ''; diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php index 73154909a4a..1c4ce50f4ef 100644 --- a/lib/private/legacy/OC_Helper.php +++ b/lib/private/legacy/OC_Helper.php @@ -168,7 +168,7 @@ class OC_Helper { /** @var SplFileInfo $fileInfo */ if ($fileInfo->isLink()) { unlink($fileInfo->getPathname()); - } else if ($fileInfo->isDir()) { + } elseif ($fileInfo->isDir()) { rmdir($fileInfo->getRealPath()); } else { unlink($fileInfo->getRealPath()); diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php index 7d23ece7ffa..829a9b81652 100644 --- a/lib/private/legacy/OC_Image.php +++ b/lib/private/legacy/OC_Image.php @@ -1078,7 +1078,7 @@ if (!function_exists('imagebmp')) { function imagebmp($im, $fileName = '', $bit = 24, $compression = 0) { if (!in_array($bit, [1, 4, 8, 16, 24, 32])) { $bit = 24; - } else if ($bit == 32) { + } elseif ($bit == 32) { $bit = 24; } $bits = pow(2, $bit); @@ -1115,7 +1115,7 @@ if (!function_exists('imagebmp')) { $bmpData .= $extra; } } // RLE8 - else if ($compression == 1 && $bit == 8) { + elseif ($compression == 1 && $bit == 8) { for ($j = $height - 1; $j >= 0; $j--) { $lastIndex = "\0"; $sameNum = 0; diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index 4d7d00f5dc2..9322ef07a79 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -189,7 +189,7 @@ class OC_Util { // If we are not forced to load a specific user we load the one that is logged in if ($user === null) { $user = ''; - } else if ($user == "" && \OC::$server->getUserSession()->isLoggedIn()) { + } elseif ($user == "" && \OC::$server->getUserSession()->isLoggedIn()) { $user = OC_User::getUser(); } @@ -788,7 +788,7 @@ class OC_Util { [$urlGenerator->linkToDocs('admin-dir_permissions')]) ]; } - } else if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) { + } elseif (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) { // is_writable doesn't work for NFS mounts, so try to write a file and check if it exists. $testFile = sprintf('%s/%s.tmp', $CONFIG_DATADIRECTORY, uniqid('data_dir_writability_test_')); $handle = fopen($testFile, 'w'); @@ -1421,7 +1421,7 @@ class OC_Util { $versionDiff = version_compare($currentVersion, $installedVersion); if ($versionDiff > 0) { return true; - } else if ($config->getValue('debug', false) && $versionDiff < 0) { + } elseif ($config->getValue('debug', false) && $versionDiff < 0) { // downgrade with debug $installedMajor = explode('.', $installedVersion); $installedMajor = $installedMajor[0] . '.' . $installedMajor[1]; @@ -1434,7 +1434,7 @@ class OC_Util { // downgrade attempt, throw exception throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')'); } - } else if ($versionDiff < 0) { + } elseif ($versionDiff < 0) { // downgrade attempt, throw exception throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')'); } diff --git a/lib/private/legacy/template/functions.php b/lib/private/legacy/template/functions.php index e42ef796f0f..83751db1e31 100644 --- a/lib/private/legacy/template/functions.php +++ b/lib/private/legacy/template/functions.php @@ -81,7 +81,7 @@ function emit_script_tag($src, $script_content='') { if (!empty($src)) { // emit script tag for deferred loading from $src $s.=$defer_str.' src="' . $src .'">'; - } else if (!empty($script_content)) { + } elseif (!empty($script_content)) { // emit script tag for inline script from $script_content without defer (see MDN) $s.=">\n".$script_content."\n"; } else { diff --git a/lib/public/AppFramework/App.php b/lib/public/AppFramework/App.php index 7bf9e72637b..2d574703d80 100644 --- a/lib/public/AppFramework/App.php +++ b/lib/public/AppFramework/App.php @@ -90,7 +90,7 @@ class App { $step['args'][0] === $applicationClassName) { $setUpViaQuery = true; break; - } else if (isset($step['class'], $step['function'], $step['args'][0]) && + } elseif (isset($step['class'], $step['function'], $step['args'][0]) && $step['class'] === ServerContainer::class && $step['function'] === 'getAppContainer' && $step['args'][1] === $classNameParts[1]) { diff --git a/lib/public/AppFramework/AuthPublicShareController.php b/lib/public/AppFramework/AuthPublicShareController.php index e9d5c766c52..1170819d5ec 100644 --- a/lib/public/AppFramework/AuthPublicShareController.php +++ b/lib/public/AppFramework/AuthPublicShareController.php @@ -167,7 +167,7 @@ abstract class AuthPublicShareController extends PublicShareController { $class = (new \ReflectionClass($this))->getShortName(); if ($this->appName === 'files_sharing') { $class = strtolower($class); - } else if (substr($class, -10) === 'Controller') { + } elseif (substr($class, -10) === 'Controller') { $class = substr($class, 0, -10); } return $app .'.'. $class .'.'. $function; diff --git a/tests/Core/Command/Group/AddUserTest.php b/tests/Core/Command/Group/AddUserTest.php index 800e5ecd4f4..ad7267ca841 100644 --- a/tests/Core/Command/Group/AddUserTest.php +++ b/tests/Core/Command/Group/AddUserTest.php @@ -61,7 +61,7 @@ class AddUserTest extends TestCase { ->willReturnCallback(function ($arg) { if ($arg === 'group') { return 'myGroup'; - } else if ($arg === 'user') { + } elseif ($arg === 'user') { return 'myUser'; } throw new \Exception(); diff --git a/tests/Core/Command/Group/ListCommandTest.php b/tests/Core/Command/Group/ListCommandTest.php index 6f2a45c9706..19ed9942145 100644 --- a/tests/Core/Command/Group/ListCommandTest.php +++ b/tests/Core/Command/Group/ListCommandTest.php @@ -59,7 +59,7 @@ class ListCommandTest extends TestCase { ->willReturnCallback(function ($arg) { if ($arg === 'limit') { return '100'; - } else if ($arg === 'offset') { + } elseif ($arg === 'offset') { return '42'; } throw new \Exception(); diff --git a/tests/Core/Command/Group/RemoveUserTest.php b/tests/Core/Command/Group/RemoveUserTest.php index 18d8512fcaa..f9a25face3b 100644 --- a/tests/Core/Command/Group/RemoveUserTest.php +++ b/tests/Core/Command/Group/RemoveUserTest.php @@ -61,7 +61,7 @@ class RemoveUserTest extends TestCase { ->willReturnCallback(function ($arg) { if ($arg === 'group') { return 'myGroup'; - } else if ($arg === 'user') { + } elseif ($arg === 'user') { return 'myUser'; } throw new \Exception(); diff --git a/tests/acceptance/features/bootstrap/ThemingAppContext.php b/tests/acceptance/features/bootstrap/ThemingAppContext.php index e52c1c86b03..ed00b9e2289 100644 --- a/tests/acceptance/features/bootstrap/ThemingAppContext.php +++ b/tests/acceptance/features/bootstrap/ThemingAppContext.php @@ -113,7 +113,7 @@ class ThemingAppContext implements Context, ActorAwareInterface { // Already an RGB (R, G, B) color // Convert from "rgb(R, G, B)" string to RGB array $tmpColor = array_splice($matches, 1); - } else if ($color[0] === '#') { + } elseif ($color[0] === '#') { $color = substr($color, 1); // HEX Color, convert to RGB array. $tmpColor = sscanf($color, "%02X%02X%02X"); diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php index 9b772ca5bfc..3390e08881b 100644 --- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php +++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php @@ -1866,9 +1866,9 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg== ->willReturnCallback(function ($key, $default) { if ($key === 'appstoreenabled') { return true; - } else if ($key === 'version') { + } elseif ($key === 'version') { return '11.0.0.2'; - } else if ($key === 'appstoreurl' && $default === 'https://apps.nextcloud.com/api/v1') { + } elseif ($key === 'appstoreurl' && $default === 'https://apps.nextcloud.com/api/v1') { return 'https://custom.appsstore.endpoint/api/v1'; } else { return $default; @@ -1949,7 +1949,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg== ->willReturnCallback(function ($var, $default) { if ($var === 'appstoreenabled') { return false; - } else if ($var === 'version') { + } elseif ($var === 'version') { return '11.0.0.2'; } return $default; @@ -1968,7 +1968,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg== ->willReturnCallback(function ($var, $default) { if ($var === 'has_internet_connection') { return false; - } else if ($var === 'version') { + } elseif ($var === 'version') { return '11.0.0.2'; } return $default; @@ -1985,9 +1985,9 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg== ->willReturnCallback(function ($key, $default) { if ($key === 'appstoreenabled') { return true; - } else if ($key === 'version') { + } elseif ($key === 'version') { return '10.0.7.2'; - } else if ($key === 'appstoreurl' && $default === 'https://apps.nextcloud.com/api/v1') { + } elseif ($key === 'appstoreurl' && $default === 'https://apps.nextcloud.com/api/v1') { return 'https://custom.appsstore.endpoint/api/v1'; } else { return $default; diff --git a/tests/lib/App/AppStore/Fetcher/FetcherBase.php b/tests/lib/App/AppStore/Fetcher/FetcherBase.php index 11813c7f3bd..cfe0af40483 100644 --- a/tests/lib/App/AppStore/Fetcher/FetcherBase.php +++ b/tests/lib/App/AppStore/Fetcher/FetcherBase.php @@ -213,7 +213,7 @@ abstract class FetcherBase extends TestCase { ->willReturnCallback(function ($key, $default) { if ($key === 'appstoreenabled') { return true; - } else if ($key === 'version') { + } elseif ($key === 'version') { return '11.0.0.2'; } else { return $default; @@ -506,7 +506,7 @@ abstract class FetcherBase extends TestCase { ->willReturnCallback(function ($key, $default) { if ($key === 'appstoreenabled') { return true; - } else if ($key === 'version') { + } elseif ($key === 'version') { return '11.0.0.2'; } else { return $default; @@ -587,7 +587,7 @@ abstract class FetcherBase extends TestCase { ->willReturnCallback(function ($key, $default) { if ($key === 'appstoreenabled') { return true; - } else if ($key === 'version') { + } elseif ($key === 'version') { return '11.0.0.2'; } else { return $default; @@ -674,7 +674,7 @@ abstract class FetcherBase extends TestCase { ->willReturnCallback(function ($key, $default) { if ($key === 'appstoreenabled') { return true; - } else if ($key === 'version') { + } elseif ($key === 'version') { return '11.0.0.3'; } else { return $default; diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php index e5a3e88d98e..819eb666d7b 100644 --- a/tests/lib/AppFramework/Http/RequestTest.php +++ b/tests/lib/AppFramework/Http/RequestTest.php @@ -1120,7 +1120,7 @@ class RequestTest extends \Test\TestCase { ->willReturnCallback(function ($key, $default) { if ($key === 'overwritecondaddr') { return ''; - } else if ($key === 'overwritehost') { + } elseif ($key === 'overwritehost') { return 'my.overwritten.host'; } @@ -1144,7 +1144,7 @@ class RequestTest extends \Test\TestCase { ->willReturnCallback(function ($key, $default) { if ($key === 'trusted_proxies') { return ['1.2.3.4']; - } else if ($key === 'trusted_domains') { + } elseif ($key === 'trusted_domains') { return ['my.trusted.host']; } @@ -1173,7 +1173,7 @@ class RequestTest extends \Test\TestCase { ->willReturnCallback(function ($key, $default) { if ($key === 'trusted_proxies') { return ['1.2.3.4']; - } else if ($key === 'trusted_domains') { + } elseif ($key === 'trusted_domains') { return ['my.trusted.host']; } diff --git a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php index 95eff5f08a9..051f2936ad7 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php @@ -632,7 +632,7 @@ class ManagerTest extends TestCase { ->willReturnCallback(function ($var) { if ($var === Manager::SESSION_UID_KEY) { return false; - } else if ($var === 'app_password') { + } elseif ($var === 'app_password') { return false; } return true; diff --git a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php index b4a9b3d0955..ac84ef04d33 100644 --- a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php @@ -463,7 +463,7 @@ class GroupPluginTest extends TestCase { { if ($appName === 'core' && $key === 'shareapi_only_share_with_group_members') { return $shareWithGroupOnly ? 'yes' : 'no'; - } else if ($appName === 'core' && $key === 'shareapi_allow_share_dialog_user_enumeration') { + } elseif ($appName === 'core' && $key === 'shareapi_allow_share_dialog_user_enumeration') { return $shareeEnumeration ? 'yes' : 'no'; } return $default; diff --git a/tests/lib/Collaboration/Collaborators/MailPluginTest.php b/tests/lib/Collaboration/Collaborators/MailPluginTest.php index 5a690393d6c..f2d4ce0cf70 100644 --- a/tests/lib/Collaboration/Collaborators/MailPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/MailPluginTest.php @@ -536,7 +536,7 @@ class MailPluginTest extends TestCase { function ($appName, $key, $default) { if ($appName === 'core' && $key === 'shareapi_allow_share_dialog_user_enumeration') { return 'yes'; - } else if ($appName === 'core' && $key === 'shareapi_only_share_with_group_members') { + } elseif ($appName === 'core' && $key === 'shareapi_only_share_with_group_members') { return 'yes'; } return $default; diff --git a/tests/lib/Collaboration/Collaborators/UserPluginTest.php b/tests/lib/Collaboration/Collaborators/UserPluginTest.php index bacf68f652e..bba061f8e2b 100644 --- a/tests/lib/Collaboration/Collaborators/UserPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/UserPluginTest.php @@ -97,9 +97,9 @@ class UserPluginTest extends TestCase { function ($appName, $key, $default) use ($shareWithGroupOnly, $shareeEnumeration, $shareeEnumerationLimitToGroup) { if ($appName === 'core' && $key === 'shareapi_only_share_with_group_members') { return $shareWithGroupOnly ? 'yes' : 'no'; - } else if ($appName === 'core' && $key === 'shareapi_allow_share_dialog_user_enumeration') { + } elseif ($appName === 'core' && $key === 'shareapi_allow_share_dialog_user_enumeration') { return $shareeEnumeration ? 'yes' : 'no'; - } else if ($appName === 'core' && $key === 'shareapi_restrict_user_enumeration_to_group') { + } elseif ($appName === 'core' && $key === 'shareapi_restrict_user_enumeration_to_group') { return $shareeEnumerationLimitToGroup ? 'yes' : 'no'; } return $default; diff --git a/tests/lib/Comments/CommentTest.php b/tests/lib/Comments/CommentTest.php index 686c2bcd19e..733597c2b4c 100644 --- a/tests/lib/Comments/CommentTest.php +++ b/tests/lib/Comments/CommentTest.php @@ -181,7 +181,7 @@ class CommentTest extends TestCase { while($mention = array_shift($mentions)) { if ($mention['type'] === 'user') { $id = array_shift($expectedUids); - } else if ($mention['type'] === 'guest') { + } elseif ($mention['type'] === 'guest') { $id = array_shift($expectedGuests); } else { $this->fail('Unexpected mention type'); diff --git a/tests/lib/DB/MigrationsTest.php b/tests/lib/DB/MigrationsTest.php index 15415a4061c..52e849fd0a8 100644 --- a/tests/lib/DB/MigrationsTest.php +++ b/tests/lib/DB/MigrationsTest.php @@ -326,7 +326,7 @@ class MigrationsTest extends \Test\TestCase { $defaultName = 'PRIMARY'; if ($this->db->getDatabasePlatform() instanceof PostgreSqlPlatform) { $defaultName = \str_repeat('a', 26) . '_' . \str_repeat('b', 30) . '_seq'; - } else if ($this->db->getDatabasePlatform() instanceof OraclePlatform) { + } elseif ($this->db->getDatabasePlatform() instanceof OraclePlatform) { $defaultName = \str_repeat('a', 26) . '_seq'; } @@ -407,7 +407,7 @@ class MigrationsTest extends \Test\TestCase { $defaultName = 'PRIMARY'; if ($this->db->getDatabasePlatform() instanceof PostgreSqlPlatform) { $defaultName = \str_repeat('a', 27) . '_' . \str_repeat('b', 30) . '_seq'; - } else if ($this->db->getDatabasePlatform() instanceof OraclePlatform) { + } elseif ($this->db->getDatabasePlatform() instanceof OraclePlatform) { $defaultName = \str_repeat('a', 27) . '_seq'; } diff --git a/tests/lib/Files/FilesystemTest.php b/tests/lib/Files/FilesystemTest.php index 39545b542e7..5bf998df562 100644 --- a/tests/lib/Files/FilesystemTest.php +++ b/tests/lib/Files/FilesystemTest.php @@ -391,7 +391,7 @@ class FilesystemTest extends \Test\TestCase { $this->assertTrue($homeMount->instanceOfStorage('\OCP\Files\IHomeStorage')); if ($homeMount->instanceOfStorage('\OC\Files\ObjectStore\HomeObjectStoreStorage')) { $this->assertEquals('object::user:' . $userId, $homeMount->getId()); - } else if ($homeMount->instanceOfStorage('\OC\Files\Storage\Home')) { + } elseif ($homeMount->instanceOfStorage('\OC\Files\Storage\Home')) { $this->assertEquals('home::' . $userId, $homeMount->getId()); } diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index c1da385a3cc..369c94c3530 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -2469,7 +2469,7 @@ class ViewTest extends \Test\TestCase { private function getFileLockType(View $view, $path, $onMountPoint = false) { if ($this->isFileLocked($view, $path, ILockingProvider::LOCK_EXCLUSIVE, $onMountPoint)) { return ILockingProvider::LOCK_EXCLUSIVE; - } else if ($this->isFileLocked($view, $path, ILockingProvider::LOCK_SHARED, $onMountPoint)) { + } elseif ($this->isFileLocked($view, $path, ILockingProvider::LOCK_SHARED, $onMountPoint)) { return ILockingProvider::LOCK_SHARED; } return null; diff --git a/tests/lib/L10N/FactoryTest.php b/tests/lib/L10N/FactoryTest.php index 33667e26fe8..73e38145d54 100644 --- a/tests/lib/L10N/FactoryTest.php +++ b/tests/lib/L10N/FactoryTest.php @@ -513,7 +513,7 @@ class FactoryTest extends TestCase { ->willReturnCallback(function ($var, $default) use ($defaultLang) { if ($var === 'installed') { return true; - } else if ($var === 'default_language') { + } elseif ($var === 'default_language') { return $defaultLang; } else { return $default; diff --git a/tests/lib/Preview/GeneratorTest.php b/tests/lib/Preview/GeneratorTest.php index 80293102631..919f7198c08 100644 --- a/tests/lib/Preview/GeneratorTest.php +++ b/tests/lib/Preview/GeneratorTest.php @@ -171,13 +171,13 @@ class GeneratorTest extends \Test\TestCase { ->willReturnCallback(function ($provider) use ($invalidProvider, $validProvider, $unavailableProvider) { if ($provider === 'wrongProvider') { $this->fail('Wrongprovider should not be constructed!'); - } else if ($provider === 'brokenProvider') { + } elseif ($provider === 'brokenProvider') { return false; - } else if ($provider === 'invalidProvider') { + } elseif ($provider === 'invalidProvider') { return $invalidProvider; - } else if ($provider === 'validProvider') { + } elseif ($provider === 'validProvider') { return $validProvider; - } else if ($provider === 'unavailableProvider') { + } elseif ($provider === 'unavailableProvider') { return $unavailableProvider; } $this->fail('Unexpected provider requested'); @@ -213,7 +213,7 @@ class GeneratorTest extends \Test\TestCase { ->willReturnCallback(function ($filename) use ($maxPreview, $previewFile) { if ($filename === '2048-2048-max.png') { return $maxPreview; - } else if ($filename === '256-256.png') { + } elseif ($filename === '256-256.png') { return $previewFile; } $this->fail('Unexpected file'); diff --git a/tests/lib/Share/Backend.php b/tests/lib/Share/Backend.php index 72451d54567..a0d45b9b782 100644 --- a/tests/lib/Share/Backend.php +++ b/tests/lib/Share/Backend.php @@ -77,9 +77,9 @@ class Backend implements \OCP\Share_Backend { foreach ($items as $item) { if ($format === self::FORMAT_SOURCE) { $testItems[] = $item['item_source']; - } else if ($format === self::FORMAT_TARGET) { + } elseif ($format === self::FORMAT_TARGET) { $testItems[] = $item['item_target']; - } else if ($format === self::FORMAT_PERMISSIONS) { + } elseif ($format === self::FORMAT_PERMISSIONS) { $testItems[] = $item['permissions']; } } diff --git a/tests/lib/Template/JSCombinerTest.php b/tests/lib/Template/JSCombinerTest.php index b892749806d..abafc583ccf 100644 --- a/tests/lib/Template/JSCombinerTest.php +++ b/tests/lib/Template/JSCombinerTest.php @@ -123,9 +123,9 @@ class JSCombinerTest extends \Test\TestCase { ->willReturnCallback(function ($path) use ($file, $gzfile) { if ($path === 'combine.js') { return $file; - } else if ($path === 'combine.js.deps') { + } elseif ($path === 'combine.js.deps') { throw new NotFoundException(); - } else if ($path === 'combine.js.gzip') { + } elseif ($path === 'combine.js.gzip') { return $gzfile; } $this->fail(); @@ -160,9 +160,9 @@ class JSCombinerTest extends \Test\TestCase { ->willReturnCallback(function ($path) use ($file, $gzfile) { if ($path === 'combine.js') { return $file; - } else if ($path === 'combine.js.deps') { + } elseif ($path === 'combine.js.deps') { throw new NotFoundException(); - } else if ($path === 'combine.js.gzip') { + } elseif ($path === 'combine.js.gzip') { return $gzfile; } $this->fail(); @@ -348,9 +348,9 @@ class JSCombinerTest extends \Test\TestCase { function ($filename) use ($file, $depsFile, $gzFile) { if ($filename === 'combine.js') { return $file; - } else if ($filename === 'combine.js.deps') { + } elseif ($filename === 'combine.js.deps') { return $depsFile; - } else if ($filename === 'combine.js.gzip') { + } elseif ($filename === 'combine.js.gzip') { return $gzFile; } $this->fail(); @@ -379,9 +379,9 @@ class JSCombinerTest extends \Test\TestCase { function ($filename) use ($file, $depsFile, $gzFile) { if ($filename === 'combine.js') { return $file; - } else if ($filename === 'combine.js.deps') { + } elseif ($filename === 'combine.js.deps') { return $depsFile; - } else if ($filename === 'combine.js.gzip') { + } elseif ($filename === 'combine.js.gzip') { return $gzFile; } $this->fail(); @@ -447,9 +447,9 @@ var b = \'world\'; function ($filename) use ($file, $depsFile, $gzFile) { if ($filename === 'combine.js') { return $file; - } else if ($filename === 'combine.js.deps') { + } elseif ($filename === 'combine.js.deps') { return $depsFile; - } else if ($filename === 'combine.js.gzip') { + } elseif ($filename === 'combine.js.gzip') { return $gzFile; } $this->fail(); diff --git a/tests/lib/Template/SCSSCacherTest.php b/tests/lib/Template/SCSSCacherTest.php index 5760ea7f8e0..09ab9363d95 100644 --- a/tests/lib/Template/SCSSCacherTest.php +++ b/tests/lib/Template/SCSSCacherTest.php @@ -123,9 +123,9 @@ class SCSSCacherTest extends \Test\TestCase { ->willReturnCallback(function ($path) use ($file, $gzfile, $filePrefix) { if ($path === $filePrefix.'styles.css') { return $file; - } else if ($path === $filePrefix.'styles.css.deps') { + } elseif ($path === $filePrefix.'styles.css.deps') { throw new NotFoundException(); - } else if ($path === $filePrefix.'styles.css.gzip') { + } elseif ($path === $filePrefix.'styles.css.gzip') { return $gzfile; } else { $this->fail(); @@ -163,9 +163,9 @@ class SCSSCacherTest extends \Test\TestCase { ->willReturnCallback(function ($path) use ($file, $gzfile, $filePrefix) { if ($path === $filePrefix.'styles.css') { return $file; - } else if ($path === $filePrefix.'styles.css.deps') { + } elseif ($path === $filePrefix.'styles.css.deps') { throw new NotFoundException(); - } else if ($path === $filePrefix.'styles.css.gzip') { + } elseif ($path === $filePrefix.'styles.css.gzip') { return $gzfile; }else { $this->fail(); @@ -199,9 +199,9 @@ class SCSSCacherTest extends \Test\TestCase { ->willReturnCallback(function ($name) use ($file, $fileDeps, $gzFile, $filePrefix) { if ($name === $filePrefix.'styles.css') { return $file; - } else if ($name === $filePrefix.'styles.css.deps') { + } elseif ($name === $filePrefix.'styles.css.deps') { return $fileDeps; - } else if ($name === $filePrefix.'styles.css.gzip') { + } elseif ($name === $filePrefix.'styles.css.gzip') { return $gzFile; } $this->fail(); @@ -237,9 +237,9 @@ class SCSSCacherTest extends \Test\TestCase { ->willReturnCallback(function ($name) use ($file, $fileDeps, $gzFile, $filePrefix) { if ($name === $filePrefix.'styles.css') { return $file; - } else if ($name === $filePrefix.'styles.css.deps') { + } elseif ($name === $filePrefix.'styles.css.deps') { return $fileDeps; - } else if ($name === $filePrefix.'styles.css.gzip') { + } elseif ($name === $filePrefix.'styles.css.gzip') { return $gzFile; } $this->fail(); @@ -275,7 +275,7 @@ class SCSSCacherTest extends \Test\TestCase { ->willReturnCallback(function ($path) use ($file) { if ($path === 'styles.css') { return $file; - } else if ($path === 'styles.css.deps') { + } elseif ($path === 'styles.css.deps') { throw new NotFoundException(); } else { $this->fail(); @@ -303,9 +303,9 @@ class SCSSCacherTest extends \Test\TestCase { $folder->method('newFile')->willReturnCallback(function ($fileName) use ($file, $depsFile, $gzipFile) { if ($fileName === 'styles.css') { return $file; - } else if ($fileName === 'styles.css.deps') { + } elseif ($fileName === 'styles.css.deps') { return $depsFile; - } else if ($fileName === 'styles.css.gzip') { + } elseif ($fileName === 'styles.css.gzip') { return $gzipFile; } throw new \Exception(); @@ -337,9 +337,9 @@ class SCSSCacherTest extends \Test\TestCase { $folder->method('getFile')->willReturnCallback(function ($fileName) use ($file, $depsFile, $gzipFile) { if ($fileName === 'styles.css') { return $file; - } else if ($fileName === 'styles.css.deps') { + } elseif ($fileName === 'styles.css.deps') { return $depsFile; - } else if ($fileName === 'styles.css.gzip') { + } elseif ($fileName === 'styles.css.gzip') { return $gzipFile; } throw new \Exception(); @@ -371,9 +371,9 @@ class SCSSCacherTest extends \Test\TestCase { $folder->method('getFile')->willReturnCallback(function ($fileName) use ($file, $depsFile, $gzipFile) { if ($fileName === 'styles-success.css') { return $file; - } else if ($fileName === 'styles-success.css.deps') { + } elseif ($fileName === 'styles-success.css.deps') { return $depsFile; - } else if ($fileName === 'styles-success.css.gzip') { + } elseif ($fileName === 'styles-success.css.gzip') { return $gzipFile; } throw new \Exception(); |