Merge pull request #52462 from nextcloud/dependabot/composer/vendor-bin/cs-fixer/stable30/nextcloud/coding-standard-1.2.2

build(deps): bump nextcloud/coding-standard from 1.2.1 to 1.2.2 in /vendor-bin/cs-fixer
This commit is contained in:
Ferdinand Thiessen 2025-04-30 19:23:06 +02:00 committed by GitHub
commit 42cc37422b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2003 changed files with 10076 additions and 8753 deletions

View file

@ -2,3 +2,6 @@
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
# Update to coding-standard 1.2.2
98d8ae805eb6ff38e60237ad4b599605df981322

View file

@ -41,7 +41,7 @@ class Files extends Action {
];
} catch (InvalidPathException|NotFoundException $e) {
\OCP\Server::get(LoggerInterface::class)->error(
"Exception thrown in file read: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
'Exception thrown in file read: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
);
return;
}
@ -61,7 +61,7 @@ class Files extends Action {
$this->renamedNodes[$source->getId()] = $source;
} catch (InvalidPathException|NotFoundException $e) {
\OCP\Server::get(LoggerInterface::class)->error(
"Exception thrown in file rename: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
'Exception thrown in file rename: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
);
return;
}
@ -81,7 +81,7 @@ class Files extends Action {
];
} catch (InvalidPathException|NotFoundException $e) {
\OCP\Server::get(LoggerInterface::class)->error(
"Exception thrown in file rename: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
'Exception thrown in file rename: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
);
return;
}
@ -105,7 +105,7 @@ class Files extends Action {
];
} catch (InvalidPathException|NotFoundException $e) {
\OCP\Server::get(LoggerInterface::class)->error(
"Exception thrown in file create: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
'Exception thrown in file create: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
);
return;
}
@ -132,7 +132,7 @@ class Files extends Action {
];
} catch (InvalidPathException|NotFoundException $e) {
\OCP\Server::get(LoggerInterface::class)->error(
"Exception thrown in file copy: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
'Exception thrown in file copy: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
);
return;
}
@ -155,7 +155,7 @@ class Files extends Action {
];
} catch (InvalidPathException|NotFoundException $e) {
\OCP\Server::get(LoggerInterface::class)->error(
"Exception thrown in file write: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
'Exception thrown in file write: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
);
return;
}
@ -181,7 +181,7 @@ class Files extends Action {
];
} catch (InvalidPathException|NotFoundException $e) {
\OCP\Server::get(LoggerInterface::class)->error(
"Exception thrown in file delete: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
'Exception thrown in file delete: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
);
return;
}
@ -210,7 +210,7 @@ class Files extends Action {
];
} catch (InvalidPathException|NotFoundException $e) {
\OCP\Server::get(LoggerInterface::class)->error(
"Exception thrown in file preview: ".$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
'Exception thrown in file preview: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
);
return;
}

View file

@ -55,8 +55,8 @@ class Capabilities implements ICapability {
$resource = $this->provider->createNewResourceType();
$resource->setName('file')
->setShareTypes(['user', 'group'])
->setProtocols(['webdav' => '/public.php/webdav/']);
->setShareTypes(['user', 'group'])
->setProtocols(['webdav' => '/public.php/webdav/']);
$this->provider->addResourceType($resource);

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -71,9 +72,9 @@ class RequestHandlerController extends Controller {
* @param string $resourceType 'file', 'calendar',...
*
* @return JSONResponse<Http::STATUS_CREATED, CloudFederationAPIAddShare, array{}>|JSONResponse<Http::STATUS_BAD_REQUEST, CloudFederationAPIValidationError, array{}>|JSONResponse<Http::STATUS_NOT_IMPLEMENTED, CloudFederationAPIError, array{}>
* 201: The notification was successfully received. The display name of the recipient might be returned in the body
* 400: Bad request due to invalid parameters, e.g. when `shareWith` is not found or required properties are missing
* 501: Share type or the resource type is not supported
* 201: The notification was successfully received. The display name of the recipient might be returned in the body
* 400: Bad request due to invalid parameters, e.g. when `shareWith` is not found or required properties are missing
* 501: Share type or the resource type is not supported
*/
#[PublicPage]
#[NoCSRFRequired]
@ -196,10 +197,10 @@ class RequestHandlerController extends Controller {
* @param array<string, mixed>|null $notification The actual payload of the notification
*
* @return JSONResponse<Http::STATUS_CREATED, array<string, mixed>, array{}>|JSONResponse<Http::STATUS_BAD_REQUEST, CloudFederationAPIValidationError, array{}>|JSONResponse<Http::STATUS_FORBIDDEN|Http::STATUS_NOT_IMPLEMENTED, CloudFederationAPIError, array{}>
* 201: The notification was successfully received
* 400: Bad request due to invalid parameters, e.g. when `type` is invalid or missing
* 403: Getting resource is not allowed
* 501: The resource type is not supported
* 201: The notification was successfully received
* 400: Bad request due to invalid parameters, e.g. when `type` is invalid or missing
* 403: Getting resource is not allowed
* 501: The resource type is not supported
*/
#[NoCSRFRequired]
#[PublicPage]

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -38,7 +38,7 @@ class Listener {
// Get all mount point owners
$cache = $this->mountCollection->getMountCache();
$mounts = $cache->getMountsForFileId((int)$event->getComment()->getObjectId());
$mounts = $cache->getMountsForFileId((int) $event->getComment()->getObjectId());
if (empty($mounts)) {
return;
}
@ -47,7 +47,7 @@ class Listener {
foreach ($mounts as $mount) {
$owner = $mount->getUser()->getUID();
$ownerFolder = $this->rootFolder->getUserFolder($owner);
$nodes = $ownerFolder->getById((int)$event->getComment()->getObjectId());
$nodes = $ownerFolder->getById((int) $event->getComment()->getObjectId());
if (!empty($nodes)) {
/** @var Node $node */
$node = array_shift($nodes);
@ -75,7 +75,7 @@ class Listener {
foreach ($users as $user => $path) {
// numerical user ids end up as integers from array keys, but string
// is required
$activity->setAffectedUser((string)$user);
$activity->setAffectedUser((string) $user);
$activity->setSubject('add_comment_subject', [
'actor' => $actor,

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -69,7 +70,7 @@ class NotificationsController extends Controller {
return new NotFoundResponse();
}
$userFolder = $this->rootFolder->getUserFolder($currentUser->getUID());
$files = $userFolder->getById((int)$comment->getObjectId());
$files = $userFolder->getById((int) $comment->getObjectId());
$this->markProcessed($comment, $currentUser);

View file

@ -28,7 +28,7 @@ class CommentsEntityEventListener implements IEventListener {
}
$event->addEntityCollection('files', function ($name): bool {
$nodes = $this->rootFolder->getUserFolder($this->userId)->getById((int)$name);
$nodes = $this->rootFolder->getUserFolder($this->userId)->getById((int) $name);
return !empty($nodes);
});
}

View file

@ -22,6 +22,6 @@ class MaxAutoCompleteResultsInitialState extends InitialStateProvider {
}
public function getData(): int {
return (int)$this->config->getAppValue('comments', 'maxAutoCompleteResults', '10');
return (int) $this->config->getAppValue('comments', 'maxAutoCompleteResults', '10');
}
}

View file

@ -84,7 +84,7 @@ class Notifier implements INotifier {
throw new UnknownNotificationException('Unsupported comment object');
}
$userFolder = $this->rootFolder->getUserFolder($notification->getUser());
$nodes = $userFolder->getById((int)$parameters[1]);
$nodes = $userFolder->getById((int) $parameters[1]);
if (empty($nodes)) {
throw new AlreadyProcessedException();
}

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -11,9 +12,9 @@ use OCP\Comments\ICommentsManager;
use Test\TestCase;
class CommentersSorterTest extends TestCase {
/** @var ICommentsManager|\PHPUnit\Framework\MockObject\MockObject */
/** @var ICommentsManager|\PHPUnit\Framework\MockObject\MockObject */
protected $commentsManager;
/** @var CommentersSorter */
/** @var CommentersSorter */
protected $sorter;
protected function setUp(): void {

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -13,7 +14,7 @@ use OCP\Comments\IComment;
use Test\TestCase;
class EventHandlerTest extends TestCase {
/** @var CommentsEventListener */
/** @var CommentsEventListener */
protected $eventHandler;
/** @var ActivityListener|\PHPUnit\Framework\MockObject\MockObject */

View file

@ -26,7 +26,7 @@ class ListenerTest extends TestCase {
/** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
protected $urlGenerator;
/** @var Listener */
/** @var Listener */
protected $listener;
protected function setUp(): void {

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -39,7 +39,7 @@ class AddressBook extends ExternalAddressBook implements IACL {
* @throws Exception
*/
public function delete(): void {
throw new Exception("This addressbook is immutable");
throw new Exception('This addressbook is immutable');
}
/**
@ -47,7 +47,7 @@ class AddressBook extends ExternalAddressBook implements IACL {
* @throws Exception
*/
public function createFile($name, $data = null) {
throw new Exception("This addressbook is immutable");
throw new Exception('This addressbook is immutable');
}
/**
@ -59,13 +59,13 @@ class AddressBook extends ExternalAddressBook implements IACL {
return new Card(
$this->mapper->find(
$this->getUid(),
(int)$name
(int) $name
),
$this->principalUri,
$this->getACL()
);
} catch (DoesNotExistException $ex) {
throw new NotFound("Contact does not exist: " . $ex->getMessage(), 0, $ex);
throw new NotFound('Contact does not exist: ' . $ex->getMessage(), 0, $ex);
}
}
@ -92,7 +92,7 @@ class AddressBook extends ExternalAddressBook implements IACL {
try {
$this->mapper->find(
$this->getUid(),
(int)$name
(int) $name
);
return true;
} catch (DoesNotExistException $e) {
@ -112,7 +112,7 @@ class AddressBook extends ExternalAddressBook implements IACL {
* @throws Exception
*/
public function propPatch(PropPatch $propPatch) {
throw new Exception("This addressbook is immutable");
throw new Exception('This addressbook is immutable');
}
/**

View file

@ -50,7 +50,7 @@ class CardSearchDao {
}
$addressbooksQuery->selectDistinct('id')
->from('addressbooks')
->where($addressbooksQuery->expr()->eq('principaluri', $cardQuery->createNamedParameter("principals/users/" . $user->getUID())));
->where($addressbooksQuery->expr()->eq('principaluri', $cardQuery->createNamedParameter('principals/users/' . $user->getUID())));
$propQuery->selectDistinct('cardid')
->from('cards_properties')
->where($propQuery->expr()->in('addressbookid', $propQuery->createFunction($addressbooksQuery->getSQL()), IQueryBuilder::PARAM_INT_ARRAY))

View file

@ -100,7 +100,7 @@ class RecentContactMapper extends QBMapper {
return null;
}
return (int)$row['last_contact'];
return (int) $row['last_contact'];
}
public function cleanUp(int $olderThan): void {

View file

@ -45,12 +45,12 @@ class ContactInteractionListener implements IEventListener {
}
if ($event->getUid() === null && $event->getEmail() === null && $event->getFederatedCloudId() === null) {
$this->logger->warning("Contact interaction event has no user identifier set");
$this->logger->warning('Contact interaction event has no user identifier set');
return;
}
if ($event->getUid() !== null && $event->getUid() === $event->getActor()->getUID()) {
$this->logger->info("Ignoring contact interaction with self");
$this->logger->info('Ignoring contact interaction with self');
return;
}

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -43,7 +43,7 @@ class AvatarHome implements ICollection {
public function getChild($name) {
$elements = pathinfo($name);
$ext = $elements['extension'] ?? '';
$size = (int)($elements['filename'] ?? '64');
$size = (int) ($elements['filename'] ?? '64');
if (!in_array($ext, ['jpeg', 'png'], true)) {
throw new MethodNotAllowed('File format not allowed');
}

View file

@ -74,7 +74,7 @@ class AvatarNode extends File {
public function getLastModified() {
$timestamp = $this->avatar->getFile($this->size)->getMTime();
if (!empty($timestamp)) {
return (int)$timestamp;
return (int) $timestamp;
}
return $timestamp;
}

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2017 ownCloud GmbH

View file

@ -14,7 +14,7 @@ use OCP\IDBConnection;
class CleanupInvitationTokenJob extends TimedJob {
/** @var IDBConnection */
/** @var IDBConnection */
private $db;
public function __construct(IDBConnection $db, ITimeFactory $time) {

View file

@ -30,6 +30,6 @@ class DeleteOutdatedSchedulingObjects extends TimedJob {
protected function run($argument): void {
$time = $this->time->getTime() - (60 * 60);
$this->calDavBackend->deleteOutdatedSchedulingObjects($time, 50000);
$this->logger->info("Removed outdated scheduling objects");
$this->logger->info('Removed outdated scheduling objects');
}
}

View file

@ -41,7 +41,7 @@ class OutOfOfficeEventDispatcherJob extends QueuedJob {
try {
$absence = $this->absenceMapper->findById($id);
} catch (DoesNotExistException | \OCP\DB\Exception $e) {
} catch (DoesNotExistException|\OCP\DB\Exception $e) {
$this->logger->error('Failed to dispatch out-of-office event: ' . $e->getMessage(), [
'exception' => $e,
'argument' => $argument,

View file

@ -44,7 +44,7 @@ class UploadCleanup extends TimedJob {
/** @var Folder $uploads */
$uploads = $userRoot->get('uploads');
$uploadFolder = $uploads->get($folder);
} catch (NotFoundException | NoUserException $e) {
} catch (NotFoundException|NoUserException $e) {
$this->jobList->remove(self::class, $argument);
return;
}
@ -53,7 +53,7 @@ class UploadCleanup extends TimedJob {
$time = $this->time->getTime() - 60 * 60 * 24;
if (!($uploadFolder instanceof Folder)) {
$this->logger->error("Found a file inside the uploads folder. Uid: " . $uid . ' folder: ' . $folder);
$this->logger->error('Found a file inside the uploads folder. Uid: ' . $uid . ' folder: ' . $folder);
if ($uploadFolder->getMTime() < $time) {
$uploadFolder->delete();
}

View file

@ -55,14 +55,14 @@ class UserStatusAutomation extends TimedJob {
$userId = $argument['userId'];
$user = $this->userManager->get($userId);
if($user === null) {
if ($user === null) {
return;
}
$ooo = $this->coordinator->getCurrentOutOfOfficeData($user);
$continue = $this->processOutOfOfficeData($user, $ooo);
if($continue === false) {
if ($continue === false) {
return;
}
@ -150,7 +150,7 @@ class UserStatusAutomation extends TimedJob {
$effectiveEnd = \DateTime::createFromImmutable($originalEnd)->sub(new \DateInterval('P7D'));
try {
$it = new RRuleIterator((string)$available->RRULE, $effectiveStart);
$it = new RRuleIterator((string) $available->RRULE, $effectiveStart);
$it->fastForward($lastMidnight);
$startToday = $it->current();
@ -196,7 +196,7 @@ class UserStatusAutomation extends TimedJob {
return;
}
if(!$hasDndForOfficeHours) {
if (!$hasDndForOfficeHours) {
// Office hours are not set to DND, so there is nothing to do.
return;
}
@ -207,7 +207,7 @@ class UserStatusAutomation extends TimedJob {
}
private function processOutOfOfficeData(IUser $user, ?IOutOfOfficeData $ooo): bool {
if(empty($ooo)) {
if (empty($ooo)) {
// Reset the user status if the absence doesn't exist
$this->logger->debug('User has no OOO period in effect, reverting DND status if applicable');
$this->manager->revertUserStatus($user->getUID(), IUserStatus::MESSAGE_OUT_OF_OFFICE, IUserStatus::DND);
@ -215,12 +215,12 @@ class UserStatusAutomation extends TimedJob {
return true;
}
if(!$this->coordinator->isInEffect($ooo)) {
if (!$this->coordinator->isInEffect($ooo)) {
// Reset the user status if the absence is (no longer) in effect
$this->logger->debug('User has no OOO period in effect, reverting DND status if applicable');
$this->manager->revertUserStatus($user->getUID(), IUserStatus::MESSAGE_OUT_OF_OFFICE, IUserStatus::DND);
if($ooo->getStartDate() > $this->time->getTime()) {
if ($ooo->getStartDate() > $this->time->getTime()) {
// Set the next run to take place at the start of the ooo period if it is in the future
// This might be overwritten if there is an availability setting, but we can't determine
// if this is the case here

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-only
@ -44,7 +45,7 @@ class BulkUploadPlugin extends ServerPlugin {
*/
public function httpPost(RequestInterface $request, ResponseInterface $response): bool {
// Limit bulk upload to the /dav/bulk endpoint
if ($request->getPath() !== "bulk") {
if ($request->getPath() !== 'bulk') {
return true;
}
@ -77,16 +78,16 @@ class BulkUploadPlugin extends ServerPlugin {
$node = $this->userFolder->getFirstNodeById($node->getId());
$writtenFiles[$headers['x-file-path']] = [
"error" => false,
"etag" => $node->getETag(),
"fileid" => DavUtil::getDavFileId($node->getId()),
"permissions" => DavUtil::getDavPermissions($node),
'error' => false,
'etag' => $node->getETag(),
'fileid' => DavUtil::getDavFileId($node->getId()),
'permissions' => DavUtil::getDavPermissions($node),
];
} catch (\Exception $e) {
$this->logger->error($e->getMessage(), ['path' => $headers['x-file-path']]);
$writtenFiles[$headers['x-file-path']] = [
"error" => true,
"message" => $e->getMessage(),
'error' => true,
'message' => $e->getMessage(),
];
}
}

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-only
@ -19,10 +20,10 @@ class MultipartRequestParser {
private $stream;
/** @var string */
private $boundary = "";
private $boundary = '';
/** @var string */
private $lastBoundary = "";
private $lastBoundary = '';
/**
* @throws BadRequest
@ -39,7 +40,7 @@ class MultipartRequestParser {
}
if ($contentType === null) {
throw new BadRequest("Content-Type can not be null");
throw new BadRequest('Content-Type can not be null');
}
$this->stream = $stream;
@ -60,7 +61,7 @@ class MultipartRequestParser {
[$mimeType, $boundary] = explode(';', $contentType);
[$boundaryKey, $boundaryValue] = explode('=', $boundary);
} catch (\Exception $e) {
throw new BadRequest("Error while parsing boundary in Content-Type header.", Http::STATUS_BAD_REQUEST, $e);
throw new BadRequest('Error while parsing boundary in Content-Type header.', Http::STATUS_BAD_REQUEST, $e);
}
$boundaryValue = trim($boundaryValue);
@ -96,7 +97,7 @@ class MultipartRequestParser {
$seekBackResult = fseek($this->stream, -$expectedContentLength, SEEK_CUR);
if ($seekBackResult === -1) {
throw new Exception("Unknown error while seeking content", Http::STATUS_INTERNAL_SERVER_ERROR);
throw new Exception('Unknown error while seeking content', Http::STATUS_INTERNAL_SERVER_ERROR);
}
return $expectedContent === $content;
@ -134,7 +135,7 @@ class MultipartRequestParser {
$headers = $this->readPartHeaders();
$content = $this->readPartContent($headers["content-length"], $headers["x-file-md5"]);
$content = $this->readPartContent($headers['content-length'], $headers['x-file-md5']);
return [$headers, $content];
}
@ -146,7 +147,7 @@ class MultipartRequestParser {
*/
private function readBoundary(): string {
if (!$this->isAtBoundary()) {
throw new BadRequest("Boundary not found where it should be.");
throw new BadRequest('Boundary not found where it should be.');
}
return fread($this->stream, strlen($this->boundary));
@ -180,12 +181,12 @@ class MultipartRequestParser {
}
}
if (!isset($headers["content-length"])) {
throw new LengthRequired("The Content-Length header must not be null.");
if (!isset($headers['content-length'])) {
throw new LengthRequired('The Content-Length header must not be null.');
}
if (!isset($headers["x-file-md5"])) {
throw new BadRequest("The X-File-MD5 header must not be null.");
if (!isset($headers['x-file-md5'])) {
throw new BadRequest('The X-File-MD5 header must not be null.');
}
return $headers;
@ -201,7 +202,7 @@ class MultipartRequestParser {
$computedMd5 = $this->computeMd5Hash($length);
if ($md5 !== $computedMd5) {
throw new BadRequest("Computed md5 hash is incorrect.");
throw new BadRequest('Computed md5 hash is incorrect.');
}
if ($length === 0) {
@ -215,7 +216,7 @@ class MultipartRequestParser {
}
if ($length !== 0 && feof($this->stream)) {
throw new Exception("Unexpected EOF while reading stream.");
throw new Exception('Unexpected EOF while reading stream.');
}
// Read '\r\n'.

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -40,8 +41,8 @@ class Calendar implements IFilter {
/**
* @return int whether the filter should be rather on the top or bottom of
* the admin section. The filters are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
* the admin section. The filters are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
* @since 11.0.0
*/
public function getPriority() {

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -40,8 +41,8 @@ class Todo implements IFilter {
/**
* @return int whether the filter should be rather on the top or bottom of
* the admin section. The filters are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
* the admin section. The filters are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
* @since 11.0.0
*/
public function getPriority() {

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -52,14 +53,14 @@ abstract class Base implements IProvider {
$data['name'] === CalDavBackend::PERSONAL_CALENDAR_NAME) {
return [
'type' => 'calendar',
'id' => (string)$data['id'],
'id' => (string) $data['id'],
'name' => $l->t('Personal'),
];
}
return [
'type' => 'calendar',
'id' => (string)$data['id'],
'id' => (string) $data['id'],
'name' => $data['name'],
];
}
@ -72,7 +73,7 @@ abstract class Base implements IProvider {
protected function generateLegacyCalendarParameter($id, $name) {
return [
'type' => 'calendar',
'id' => (string)$id,
'id' => (string) $id,
'name' => $name,
];
}

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -24,8 +25,8 @@ class Calendar extends CalDAVSetting {
/**
* @return int whether the filter should be rather on the top or bottom of
* the admin section. The filters are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
* the admin section. The filters are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
* @since 11.0.0
*/
public function getPriority() {

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -24,8 +25,8 @@ class Event extends CalDAVSetting {
/**
* @return int whether the filter should be rather on the top or bottom of
* the admin section. The filters are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
* the admin section. The filters are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
* @since 11.0.0
*/
public function getPriority() {

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -25,8 +26,8 @@ class Todo extends CalDAVSetting {
/**
* @return int whether the filter should be rather on the top or bottom of
* the admin section. The filters are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
* the admin section. The filters are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
* @since 11.0.0
*/
public function getPriority() {

View file

@ -174,7 +174,7 @@ class AppCalendar extends ExternalCalendar {
// We need to group by UID (actually by filename but we do not have that information)
$result = [];
foreach ($objects as $object) {
$uid = (string)$object['UID'] ?: uniqid();
$uid = (string) $object['UID'] ?: uniqid();
if (!isset($result[$uid])) {
$result[$uid] = [];
}

View file

@ -97,7 +97,7 @@ class CalendarObject implements ICalendarObject, IACL {
$components = $this->vobject->getBaseComponents();
foreach ($components as $key => $component) {
$components[$key]->STATUS = 'CANCELLED';
$components[$key]->SEQUENCE = isset($component->SEQUENCE) ? ((int)$component->SEQUENCE->getValue()) + 1 : 1;
$components[$key]->SEQUENCE = isset($component->SEQUENCE) ? ((int) $component->SEQUENCE->getValue()) + 1 : 1;
if ($component->name === 'VEVENT') {
$components[$key]->METHOD = 'CANCEL';
}
@ -116,9 +116,9 @@ class CalendarObject implements ICalendarObject, IACL {
throw new NotFound('Invalid node');
}
if (isset($base->{'X-FILENAME'})) {
return (string)$base->{'X-FILENAME'};
return (string) $base->{'X-FILENAME'};
}
return (string)$base->UID . '.ics';
return (string) $base->UID . '.ics';
}
public function setName($name): void {

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -115,7 +116,7 @@ class EnablePlugin extends ServerPlugin {
}
$owner = substr($node->getOwner(), 17);
if($owner !== $this->user->getUID()) {
if ($owner !== $this->user->getUID()) {
$this->server->httpResponse->setStatus(403);
return false;
}

View file

@ -169,7 +169,7 @@ class BirthdayService {
return null;
}
$birthday = $doc->{$dateField};
if (!(string)$birthday) {
if (!(string) $birthday) {
return null;
}
// Skip if the BDAY property is not of the right type.
@ -188,18 +188,18 @@ class BirthdayService {
$omitYear = (isset($parameters['X-APPLE-OMIT-YEAR'])
&& $parameters['X-APPLE-OMIT-YEAR'] === $dateParts['year']);
// 'X-APPLE-OMIT-YEAR' is not always present, at least iOS 12.4 uses the hard coded date of 1604 (the start of the gregorian calendar) when the year is unknown
if ($omitYear || (int)$dateParts['year'] === 1604) {
if ($omitYear || (int) $dateParts['year'] === 1604) {
$dateParts['year'] = null;
}
}
$originalYear = null;
if ($dateParts['year'] !== null) {
$originalYear = (int)$dateParts['year'];
$originalYear = (int) $dateParts['year'];
}
$leapDay = ((int)$dateParts['month'] === 2
&& (int)$dateParts['date'] === 29);
$leapDay = ((int) $dateParts['month'] === 2
&& (int) $dateParts['date'] === 29);
if ($dateParts['year'] === null || $originalYear < 1970) {
$birthday = ($leapDay ? '1972-' : '1970-')
. $dateParts['month'] . '-' . $dateParts['date'];

View file

@ -62,7 +62,7 @@ class CachedSubscriptionImpl implements ICalendar {
* @param string $pattern which should match within the $searchProperties
* @param array $searchProperties defines the properties within the query pattern should match
* @param array $options - optional parameters:
* ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]]
* ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]]
* @param int|null $limit - limit number of search results
* @param int|null $offset - offset for paging of search results
* @return array an array of events/journals/todos which are arrays of key-value-pairs

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@ -222,7 +223,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
}
$result = $query->executeQuery();
$column = (int)$result->fetchOne();
$column = (int) $result->fetchOne();
$result->closeCursor();
return $column;
}
@ -243,7 +244,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
}
$result = $query->executeQuery();
$column = (int)$result->fetchOne();
$column = (int) $result->fetchOne();
$result->closeCursor();
return $column;
}
@ -521,8 +522,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int) $row['access'] === Backend::ACCESS_READ,
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int) $row['access'] === self::ACCESS_PUBLIC,
];
$calendar = $this->rowToCalendar($row, $calendar);
@ -586,8 +587,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int) $row['access'] === Backend::ACCESS_READ,
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int) $row['access'] === self::ACCESS_PUBLIC,
];
$calendar = $this->rowToCalendar($row, $calendar);
@ -799,7 +800,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
return [$calendarId, $calendarData];
}, $this->db);
$this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData));
$this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int) $calendarId, $calendarData));
return $calendarId;
}
@ -847,7 +848,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)));
$query->executeStatement();
$this->addChanges($calendarId, [""], 2);
$this->addChanges($calendarId, [''], 2);
$calendarData = $this->getCalendarById($calendarId);
$shares = $this->getShares($calendarId);
@ -1046,9 +1047,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'lastmodified' => $row['lastmodified'],
'etag' => '"' . $row['etag'] . '"',
'calendarid' => $row['calendarid'],
'size' => (int)$row['size'],
'size' => (int) $row['size'],
'component' => strtolower($row['componenttype']),
'classification' => (int)$row['classification']
'classification' => (int) $row['classification']
];
}
$stmt->closeCursor();
@ -1113,9 +1114,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'etag' => '"' . $row['etag'] . '"',
'calendarid' => $row['calendarid'],
'calendaruri' => $row['calendaruri'],
'size' => (int)$row['size'],
'size' => (int) $row['size'],
'component' => strtolower($row['componenttype']),
'classification' => (int)$row['classification'],
'classification' => (int) $row['classification'],
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'],
];
}
@ -1173,10 +1174,10 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'lastmodified' => $row['lastmodified'],
'etag' => '"' . $row['etag'] . '"',
'calendarid' => $row['calendarid'],
'size' => (int)$row['size'],
'size' => (int) $row['size'],
'calendardata' => $this->readBlob($row['calendardata']),
'component' => strtolower($row['componenttype']),
'classification' => (int)$row['classification'],
'classification' => (int) $row['classification'],
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'],
];
}
@ -1221,10 +1222,10 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'lastmodified' => $row['lastmodified'],
'etag' => '"' . $row['etag'] . '"',
'calendarid' => $row['calendarid'],
'size' => (int)$row['size'],
'size' => (int) $row['size'],
'calendardata' => $this->readBlob($row['calendardata']),
'component' => strtolower($row['componenttype']),
'classification' => (int)$row['classification']
'classification' => (int) $row['classification']
];
}
$result->closeCursor();
@ -1354,15 +1355,15 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
return $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) {
$query = $this->db->getQueryBuilder();
$query->update('calendarobjects')
->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB))
->set('lastmodified', $query->createNamedParameter(time()))
->set('etag', $query->createNamedParameter($extraData['etag']))
->set('size', $query->createNamedParameter($extraData['size']))
->set('componenttype', $query->createNamedParameter($extraData['componentType']))
->set('firstoccurence', $query->createNamedParameter($extraData['firstOccurence']))
->set('lastoccurence', $query->createNamedParameter($extraData['lastOccurence']))
->set('classification', $query->createNamedParameter($extraData['classification']))
->set('uid', $query->createNamedParameter($extraData['uid']))
->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB))
->set('lastmodified', $query->createNamedParameter(time()))
->set('etag', $query->createNamedParameter($extraData['etag']))
->set('size', $query->createNamedParameter($extraData['size']))
->set('componenttype', $query->createNamedParameter($extraData['componentType']))
->set('firstoccurence', $query->createNamedParameter($extraData['firstOccurence']))
->set('lastoccurence', $query->createNamedParameter($extraData['lastOccurence']))
->set('classification', $query->createNamedParameter($extraData['classification']))
->set('uid', $query->createNamedParameter($extraData['uid']))
->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)))
@ -1510,13 +1511,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
if (!empty($pathInfo['extension'])) {
// Append a suffix to "free" the old URI for recreation
$newUri = sprintf(
"%s-deleted.%s",
'%s-deleted.%s',
$pathInfo['filename'],
$pathInfo['extension']
);
} else {
$newUri = sprintf(
"%s-deleted",
'%s-deleted',
$pathInfo['filename']
);
}
@ -1565,7 +1566,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$this->cachedObjects = [];
$this->atomic(function () use ($objectData) {
$id = (int) $objectData['id'];
$restoreUri = str_replace("-deleted.ics", ".ics", $objectData['uri']);
$restoreUri = str_replace('-deleted.ics', '.ics', $objectData['uri']);
$targetObject = $this->getCalendarObject(
$objectData['calendarid'],
$restoreUri
@ -1992,7 +1993,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
// For the pagination with hasLimit and hasTimeRange, a stable ordering is helpful.
$outerQuery->addOrderBy('id');
$offset = (int)$offset;
$offset = (int) $offset;
$outerQuery->setFirstResult($offset);
$calendarObjects = [];
@ -2013,7 +2014,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
*
* 25 rows and 3 retries is entirely arbitrary.
*/
$maxResults = (int)max($limit, 25);
$maxResults = (int) max($limit, 25);
$outerQuery->setMaxResults($maxResults);
for ($attempt = $objectsCount = 0; $attempt < 3 && $objectsCount < $limit; $attempt++) {
@ -2220,7 +2221,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$subscriptions = $this->getSubscriptionsForUser($principalUri);
foreach ($calendars as $calendar) {
$calendarAnd = $calendarObjectIdQuery->expr()->andX(
$calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id'])),
$calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $calendar['id'])),
$calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)),
);
@ -2234,7 +2235,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
}
foreach ($subscriptions as $subscription) {
$subscriptionAnd = $calendarObjectIdQuery->expr()->andX(
$calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id'])),
$calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $subscription['id'])),
$calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)),
);
@ -2323,8 +2324,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$result = $query->executeQuery();
$calendarObjects = [];
while (($array = $result->fetch()) !== false) {
$array['calendarid'] = (int)$array['calendarid'];
$array['calendartype'] = (int)$array['calendartype'];
$array['calendarid'] = (int) $array['calendarid'];
$array['calendartype'] = (int) $array['calendartype'];
$array['calendardata'] = $this->readBlob($array['calendardata']);
$calendarObjects[] = $array;
@ -2394,10 +2395,10 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'etag' => '"' . $row['etag'] . '"',
'calendarid' => $row['calendarid'],
'calendaruri' => $row['calendaruri'],
'size' => (int)$row['size'],
'size' => (int) $row['size'],
'calendardata' => $this->readBlob($row['calendardata']),
'component' => strtolower($row['componenttype']),
'classification' => (int)$row['classification'],
'classification' => (int) $row['classification'],
'deleted_at' => isset($row['deleted_at']) ? ((int) $row['deleted_at']) : null,
];
}
@ -2513,7 +2514,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
while ($entry = $stmt->fetch(\PDO::FETCH_NUM)) {
// assign uri (column 0) to appropriate mutation based on operation (column 1)
// forced (int) is needed as doctrine with OCI returns the operation field as string not integer
match ((int)$entry[1]) {
match ((int) $entry[1]) {
1 => $result['added'][] = $entry[0],
2 => $result['modified'][] = $entry[0],
3 => $result['deleted'][] = $entry[0],
@ -2694,7 +2695,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
return $this->getSubscriptionById($subscriptionId);
}, $this->db);
$this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations));
$this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int) $subscriptionId, $subscriptionRow, [], $mutations));
return true;
});
@ -2732,7 +2733,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->executeStatement();
if ($subscriptionRow) {
$this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, []));
$this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int) $subscriptionId, $subscriptionRow, []));
}
}, $this->db);
}
@ -2772,7 +2773,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'calendardata' => $row['calendardata'],
'lastmodified' => $row['lastmodified'],
'etag' => '"' . $row['etag'] . '"',
'size' => (int)$row['size'],
'size' => (int) $row['size'],
];
}
@ -2790,9 +2791,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
public function getSchedulingObjects($principalUri) {
$query = $this->db->getQueryBuilder();
$stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size'])
->from('schedulingobjects')
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
->executeQuery();
->from('schedulingobjects')
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
->executeQuery();
$results = [];
while (($row = $stmt->fetch()) !== false) {
@ -2801,7 +2802,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'uri' => $row['uri'],
'lastmodified' => $row['lastmodified'],
'etag' => '"' . $row['etag'] . '"',
'size' => (int)$row['size'],
'size' => (int) $row['size'],
];
}
$stmt->closeCursor();
@ -2820,9 +2821,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$this->cachedObjects = [];
$query = $this->db->getQueryBuilder();
$query->delete('schedulingobjects')
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
->executeStatement();
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
->executeStatement();
}
/**
@ -2840,11 +2841,11 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->setMaxResults($limit);
$result = $query->executeQuery();
$count = $result->rowCount();
if($count === 0) {
if ($count === 0) {
return;
}
$ids = array_map(static function (array $id) {
return (int)$id[0];
return (int) $id[0];
}, $result->fetchAll(\PDO::FETCH_NUM));
$result->closeCursor();
@ -2852,12 +2853,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$deleteQuery = $this->db->getQueryBuilder();
$deleteQuery->delete('schedulingobjects')
->where($deleteQuery->expr()->in('id', $deleteQuery->createParameter('ids'), IQueryBuilder::PARAM_INT_ARRAY));
foreach(array_chunk($ids, 1000) as $chunk) {
foreach (array_chunk($ids, 1000) as $chunk) {
$deleteQuery->setParameter('ids', $chunk, IQueryBuilder::PARAM_INT_ARRAY);
$numDeleted += $deleteQuery->executeStatement();
}
if($numDeleted === $limit) {
if ($numDeleted === $limit) {
$this->logger->info("Deleted $limit scheduling objects, continuing with next batch");
$this->deleteOutdatedSchedulingObjects($modifiedBefore, $limit);
}
@ -2905,7 +2906,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->from($table)
->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)));
$result = $query->executeQuery();
$syncToken = (int)$result->fetchOne();
$syncToken = (int) $result->fetchOne();
$result->closeCursor();
$query = $this->db->getQueryBuilder();
@ -2965,7 +2966,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
);
$resultDeleted = $qbDeleted->executeQuery();
$deletedUris = array_map(function (string $uri) {
return str_replace("-deleted.ics", ".ics", $uri);
return str_replace('-deleted.ics', '.ics', $uri);
}, $resultDeleted->fetchAll(\PDO::FETCH_COLUMN));
$resultDeleted->closeCursor();
$this->addChanges($calendarId, $deletedUris, 3, $calendarType);
@ -3009,7 +3010,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
// Track first component type and uid
if ($uid === null) {
$componentType = $component->name;
$uid = (string)$component->UID;
$uid = (string) $component->UID;
}
}
}
@ -3332,7 +3333,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
* @param array<string> $calendarObjectUris
*/
public function purgeCachedEventsForSubscription(int $subscriptionId, array $calendarObjectIds, array $calendarObjectUris): void {
if(empty($calendarObjectUris)) {
if (empty($calendarObjectUris)) {
return;
}
@ -3432,7 +3433,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri);
}
return (int)$objectIds['id'];
return (int) $objectIds['id'];
}
/**

View file

@ -149,9 +149,9 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome {
// Calendar - this covers all "regular" calendars, but not shared
// only check if the method is available
if($this->caldavBackend instanceof CalDavBackend) {
if ($this->caldavBackend instanceof CalDavBackend) {
$calendar = $this->caldavBackend->getCalendarByUri($this->principalInfo['uri'], $name);
if(!empty($calendar)) {
if (!empty($calendar)) {
return new Calendar($this->caldavBackend, $calendar, $this->l10n, $this->config, $this->logger);
}
}

View file

@ -84,7 +84,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage {
/** @var VCalendar $vobj */
$vobj = Reader::read($timezoneProp);
$components = $vobj->getComponents();
if(empty($components)) {
if (empty($components)) {
return null;
}
/** @var VTimeZone $vtimezone */
@ -96,7 +96,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage {
* @param string $pattern which should match within the $searchProperties
* @param array $searchProperties defines the properties within the query pattern should match
* @param array $options - optional parameters:
* ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]]
* ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]]
* @param int|null $limit - limit number of search results
* @param int|null $offset - offset for paging of search results
* @return array an array of events/journals/todos which are arrays of key-value-pairs
@ -233,7 +233,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage {
}
$iTipMessage->uid = isset($vEvent->{'UID'}) ? $vEvent->{'UID'}->getValue() : '';
$iTipMessage->component = 'VEVENT';
$iTipMessage->sequence = isset($vEvent->{'SEQUENCE'}) ? (int)$vEvent->{'SEQUENCE'}->getValue() : 0;
$iTipMessage->sequence = isset($vEvent->{'SEQUENCE'}) ? (int) $vEvent->{'SEQUENCE'}->getValue() : 0;
$iTipMessage->message = $vObject;
$server->server->emit('schedule', [$iTipMessage]);
}

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@ -137,7 +138,7 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject {
}
public function getCalendarId(): int {
return (int)$this->objectData['calendarid'];
return (int) $this->objectData['calendarid'];
}
public function getPrincipalUri(): string {

View file

@ -37,14 +37,14 @@ class EventComparisonService {
*/
private function removeIfUnchanged(VEvent $filterEvent, array &$eventsToFilter): bool {
$filterEventData = [];
foreach(self::EVENT_DIFF as $eventDiff) {
foreach (self::EVENT_DIFF as $eventDiff) {
$filterEventData[] = IMipService::readPropertyWithDefault($filterEvent, $eventDiff, '');
}
/** @var VEvent $component */
foreach ($eventsToFilter as $k => $eventToFilter) {
$eventToFilterData = [];
foreach(self::EVENT_DIFF as $eventDiff) {
foreach (self::EVENT_DIFF as $eventDiff) {
$eventToFilterData[] = IMipService::readPropertyWithDefault($eventToFilter, $eventDiff, '');
}
// events are identical and can be removed
@ -73,23 +73,23 @@ class EventComparisonService {
$newEventComponents = $new->getComponents();
foreach ($newEventComponents as $k => $event) {
if(!$event instanceof VEvent) {
if (!$event instanceof VEvent) {
unset($newEventComponents[$k]);
}
}
if(empty($old)) {
if (empty($old)) {
return ['old' => null, 'new' => $newEventComponents];
}
$oldEventComponents = $old->getComponents();
if(is_array($oldEventComponents) && !empty($oldEventComponents)) {
if (is_array($oldEventComponents) && !empty($oldEventComponents)) {
foreach ($oldEventComponents as $k => $event) {
if(!$event instanceof VEvent) {
if (!$event instanceof VEvent) {
unset($oldEventComponents[$k]);
continue;
}
if($this->removeIfUnchanged($event, $newEventComponents)) {
if ($this->removeIfUnchanged($event, $newEventComponents)) {
unset($oldEventComponents[$k]);
}
}

View file

@ -67,8 +67,8 @@ class EventReader {
* @since 30.0.0
*
* @param VCalendar|VEvent|Array|String $input
* @param string|null $uid
* @param DateTimeZone|null $timeZone reference timezone for floating dates and times
* @param string|null $uid
* @param DateTimeZone|null $timeZone reference timezone for floating dates and times
*/
public function __construct(VCalendar|VEvent|array|string $input, ?string $uid = null, ?DateTimeZone $timeZone = null) {
@ -308,9 +308,9 @@ class EventReader {
*
* @since 30.0.0
*
* @return string|null R - Relative or A - Absolute
* @return string|null R - Relative or A - Absolute
*/
public function recurringPattern(): string | null {
public function recurringPattern(): string|null {
if ($this->rruleIterator === null && $this->rdateIterator === null) {
return null;
}
@ -325,9 +325,9 @@ class EventReader {
*
* @since 30.0.0
*
* @return string|null daily, weekly, monthly, yearly, fixed
* @return string|null daily, weekly, monthly, yearly, fixed
*/
public function recurringPrecision(): string | null {
public function recurringPrecision(): string|null {
if ($this->rruleIterator !== null) {
return $this->rruleIterator->precision();
}
@ -344,7 +344,7 @@ class EventReader {
*
* @return int|null
*/
public function recurringInterval(): int | null {
public function recurringInterval(): int|null {
return $this->rruleIterator?->interval();
}
@ -387,7 +387,7 @@ class EventReader {
*
* @return int|null
*/
public function recurringConcludesAfter(): int | null {
public function recurringConcludesAfter(): int|null {
// construct count place holder
$count = 0;
@ -412,7 +412,7 @@ class EventReader {
*
* @return DateTime|null
*/
public function recurringConcludesOn(): DateTime | null {
public function recurringConcludesOn(): DateTime|null {
if ($this->rruleIterator !== null) {
// retrieve rrule conclusion date
@ -639,7 +639,7 @@ class EventReader {
*
* @return DateTime
*/
public function recurrenceDate(): DateTime | null {
public function recurrenceDate(): DateTime|null {
if ($this->recurrenceCurrentDate !== null) {
return DateTime::createFromInterface($this->recurrenceCurrentDate);
} else {
@ -758,7 +758,7 @@ class EventReader {
*
* @since 30.0.0
*
* @param DateTimeInterface $dt date and time to advance
* @param DateTimeInterface $dt date and time to advance
*
* @return void
*/

View file

@ -13,15 +13,15 @@ use DateTime;
class EventReaderRDate extends \Sabre\VObject\Recur\RDateIterator {
public function concludes(): DateTime | null {
public function concludes(): DateTime|null {
return $this->concludesOn();
}
public function concludesAfter(): int | null {
public function concludesAfter(): int|null {
return !empty($this->dates) ? count($this->dates) : null;
}
public function concludesOn(): DateTime | null {
public function concludesOn(): DateTime|null {
if (count($this->dates) > 0) {
return new DateTime(
$this->dates[array_key_last($this->dates)],

View file

@ -22,7 +22,7 @@ class EventReaderRRule extends \Sabre\VObject\Recur\RRuleIterator {
return $this->interval;
}
public function concludes(): DateTime | null {
public function concludes(): DateTime|null {
// evaluate if until value is a date
if ($this->until instanceof DateTimeInterface) {
return DateTime::createFromInterface($this->until);
@ -48,11 +48,11 @@ class EventReaderRRule extends \Sabre\VObject\Recur\RRuleIterator {
return null;
}
public function concludesAfter(): int | null {
public function concludesAfter(): int|null {
return !empty($this->count) ? $this->count : null;
}
public function concludesOn(): DateTime | null {
public function concludesOn(): DateTime|null {
return isset($this->until) ? DateTime::createFromInterface($this->until) : null;
}

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -417,24 +417,24 @@ class EmailProvider extends AbstractProvider {
}
private function getWeekDayName(IL10N $l10n, DateTime $dt):string {
return (string)$l10n->l('weekdayName', $dt, ['width' => 'abbreviated']);
return (string) $l10n->l('weekdayName', $dt, ['width' => 'abbreviated']);
}
private function getDateString(IL10N $l10n, DateTime $dt):string {
return (string)$l10n->l('date', $dt, ['width' => 'medium']);
return (string) $l10n->l('date', $dt, ['width' => 'medium']);
}
private function getDateTimeString(IL10N $l10n, DateTime $dt):string {
return (string)$l10n->l('datetime', $dt, ['width' => 'medium|short']);
return (string) $l10n->l('datetime', $dt, ['width' => 'medium|short']);
}
private function getTimeString(IL10N $l10n, DateTime $dt):string {
return (string)$l10n->l('time', $dt, ['width' => 'short']);
return (string) $l10n->l('time', $dt, ['width' => 'short']);
}
private function getTitleFromVEvent(VEvent $vevent, IL10N $l10n):string {
if (isset($vevent->SUMMARY)) {
return (string)$vevent->SUMMARY;
return (string) $vevent->SUMMARY;
}
return $l10n->t('Untitled event');

View file

@ -292,7 +292,7 @@ class Notifier implements INotifier {
* @return string
*/
private function getWeekDayName(DateTime $dt):string {
return (string)$this->l10n->l('weekdayName', $dt, ['width' => 'abbreviated']);
return (string) $this->l10n->l('weekdayName', $dt, ['width' => 'abbreviated']);
}
/**
@ -300,7 +300,7 @@ class Notifier implements INotifier {
* @return string
*/
private function getDateString(DateTime $dt):string {
return (string)$this->l10n->l('date', $dt, ['width' => 'medium']);
return (string) $this->l10n->l('date', $dt, ['width' => 'medium']);
}
/**
@ -308,7 +308,7 @@ class Notifier implements INotifier {
* @return string
*/
private function getDateTimeString(DateTime $dt):string {
return (string)$this->l10n->l('datetime', $dt, ['width' => 'medium|short']);
return (string) $this->l10n->l('datetime', $dt, ['width' => 'medium|short']);
}
/**
@ -316,6 +316,6 @@ class Notifier implements INotifier {
* @return string
*/
private function getTimeString(DateTime $dt):string {
return (string)$this->l10n->l('time', $dt, ['width' => 'short']);
return (string) $this->l10n->l('time', $dt, ['width' => 'short']);
}
}

View file

@ -447,7 +447,7 @@ class ReminderService {
$uniqueReminders = [];
foreach ($reminders as $reminder) {
$key = $reminder['notification_date']. $reminder['event_hash'].$reminder['type'];
if(!isset($uniqueReminders[$key])) {
if (!isset($uniqueReminders[$key])) {
$uniqueReminders[$key] = $reminder;
}
}

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -386,7 +387,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
try {
$stmt = $query->executeQuery();
} catch (Exception $e) {
$this->logger->error("Could not search resources: " . $e->getMessage(), ['exception' => $e]);
$this->logger->error('Could not search resources: ' . $e->getMessage(), ['exception' => $e]);
}
$rows = [];

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -95,7 +95,7 @@ class IMipPlugin extends SabreIMipPlugin {
* @param bool $modified modified
*/
public function beforeWriteContent($uri, INode $node, $data, $modified): void {
if(!$node instanceof CalendarObject) {
if (!$node instanceof CalendarObject) {
return;
}
/** @var VCalendar $vCalendar */
@ -138,7 +138,7 @@ class IMipPlugin extends SabreIMipPlugin {
$iTipMessage->scheduleStatus = '5.0; EMail delivery failed';
return;
}
$recipientName = $iTipMessage->recipientName ? (string)$iTipMessage->recipientName : null;
$recipientName = $iTipMessage->recipientName ? (string) $iTipMessage->recipientName : null;
$newEvents = $iTipMessage->message;
$oldEvents = $this->getVCalendar();
@ -152,7 +152,7 @@ class IMipPlugin extends SabreIMipPlugin {
// No changed events after all - this shouldn't happen if there is significant change yet here we are
// The scheduling status is debatable
if(empty($vEvent)) {
if (empty($vEvent)) {
$this->logger->warning('iTip message said the change was significant but comparison did not detect any updated VEvents');
$iTipMessage->scheduleStatus = '1.0;We got the message, but it\'s not significant enough to warrant an email';
return;
@ -164,14 +164,14 @@ class IMipPlugin extends SabreIMipPlugin {
// we also might not have an old event as this could be a new
// invitation, or a new recurrence exception
$attendee = $this->imipService->getCurrentAttendee($iTipMessage);
if($attendee === null) {
if ($attendee === null) {
$uid = $vEvent->UID ?? 'no UID found';
$this->logger->debug('Could not find recipient ' . $recipient . ' as attendee for event with UID ' . $uid);
$iTipMessage->scheduleStatus = '5.0; EMail delivery failed';
return;
}
// Don't send emails to things
if($this->imipService->isRoomOrResource($attendee)) {
if ($this->imipService->isRoomOrResource($attendee)) {
$this->logger->debug('No invitation sent as recipient is room or resource', [
'attendee' => $recipient,
]);

View file

@ -89,7 +89,7 @@ class IMipService {
return $default;
}
$newstring = $vevent->$property->getValue();
if(isset($oldVEvent->$property) && $oldVEvent->$property->getValue() !== $newstring) {
if (isset($oldVEvent->$property) && $oldVEvent->$property->getValue() !== $newstring) {
$oldstring = $oldVEvent->$property->getValue();
return sprintf($strikethrough, $oldstring, $newstring);
}
@ -144,7 +144,7 @@ class IMipService {
$data = [];
$data['meeting_when'] = $this->generateWhenString($eventReaderCurrent);
foreach(self::STRING_DIFF as $key => $property) {
foreach (self::STRING_DIFF as $key => $property) {
$data[$key] = self::readPropertyWithDefault($vEvent, $property, $defaultVal);
}
@ -154,7 +154,7 @@ class IMipService {
$data['meeting_location_html'] = $locationHtml;
}
if(!empty($oldVEvent)) {
if (!empty($oldVEvent)) {
$oldMeetingWhen = $this->generateWhenString($eventReaderPrevious);
$data['meeting_title_html'] = $this->generateDiffString($vEvent, $oldVEvent, 'SUMMARY', $data['meeting_title']);
$data['meeting_description_html'] = $this->generateDiffString($vEvent, $oldVEvent, 'DESCRIPTION', $data['meeting_description']);
@ -336,7 +336,7 @@ class IMipService {
public function generateWhenStringRecurringDaily(EventReader $er): string {
// initialize
$interval = (int)$er->recurringInterval();
$interval = (int) $er->recurringInterval();
$startTime = null;
$conclusion = null;
// time of the day
@ -387,7 +387,7 @@ class IMipService {
public function generateWhenStringRecurringWeekly(EventReader $er): string {
// initialize
$interval = (int)$er->recurringInterval();
$interval = (int) $er->recurringInterval();
$startTime = null;
$conclusion = null;
// days of the week
@ -440,7 +440,7 @@ class IMipService {
public function generateWhenStringRecurringMonthly(EventReader $er): string {
// initialize
$interval = (int)$er->recurringInterval();
$interval = (int) $er->recurringInterval();
$startTime = null;
$conclusion = null;
// days of month
@ -505,7 +505,7 @@ class IMipService {
public function generateWhenStringRecurringYearly(EventReader $er): string {
// initialize
$interval = (int)$er->recurringInterval();
$interval = (int) $er->recurringInterval();
$startTime = null;
$conclusion = null;
// months of year
@ -777,10 +777,10 @@ class IMipService {
$strikethrough = "<span style='text-decoration: line-through'>%s</span>";
$newMeetingWhen = $this->generateWhenString($eventReaderCurrent);
$newSummary = isset($vEvent->SUMMARY) && (string)$vEvent->SUMMARY !== '' ? (string)$vEvent->SUMMARY : $this->l10n->t('Untitled event');
$newDescription = isset($vEvent->DESCRIPTION) && (string)$vEvent->DESCRIPTION !== '' ? (string)$vEvent->DESCRIPTION : $defaultVal;
$newUrl = isset($vEvent->URL) && (string)$vEvent->URL !== '' ? sprintf('<a href="%1$s">%1$s</a>', $vEvent->URL) : $defaultVal;
$newLocation = isset($vEvent->LOCATION) && (string)$vEvent->LOCATION !== '' ? (string)$vEvent->LOCATION : $defaultVal;
$newSummary = isset($vEvent->SUMMARY) && (string) $vEvent->SUMMARY !== '' ? (string) $vEvent->SUMMARY : $this->l10n->t('Untitled event');
$newDescription = isset($vEvent->DESCRIPTION) && (string) $vEvent->DESCRIPTION !== '' ? (string) $vEvent->DESCRIPTION : $defaultVal;
$newUrl = isset($vEvent->URL) && (string) $vEvent->URL !== '' ? sprintf('<a href="%1$s">%1$s</a>', $vEvent->URL) : $defaultVal;
$newLocation = isset($vEvent->LOCATION) && (string) $vEvent->LOCATION !== '' ? (string) $vEvent->LOCATION : $defaultVal;
$newLocationHtml = $this->linkify($newLocation) ?? $newLocation;
$data = [];
@ -791,7 +791,7 @@ class IMipService {
$data['meeting_description_html'] = $newDescription !== '' ? sprintf($strikethrough, $newDescription) : '';
$data['meeting_description'] = $newDescription;
$data['meeting_url_html'] = $newUrl !== '' ? sprintf($strikethrough, $newUrl) : '';
$data['meeting_url'] = isset($vEvent->URL) ? (string)$vEvent->URL : '';
$data['meeting_url'] = isset($vEvent->URL) ? (string) $vEvent->URL : '';
$data['meeting_location_html'] = $newLocationHtml !== '' ? sprintf($strikethrough, $newLocationHtml) : '';
$data['meeting_location'] = $newLocation;
return $data;
@ -808,7 +808,7 @@ class IMipService {
$component = $vObject->VEVENT;
if (isset($component->RRULE)) {
$it = new EventIterator($vObject, (string)$component->UID);
$it = new EventIterator($vObject, (string) $component->UID);
$maxDate = new \DateTime(IMipPlugin::MAX_DATE);
if ($it->isInfinite()) {
return $maxDate->getTimestamp();
@ -831,7 +831,7 @@ class IMipService {
return $dtEnd->getDateTime()->getTimeStamp();
}
if(isset($component->DURATION)) {
if (isset($component->DURATION)) {
/** @var \DateTime $endDate */
$endDate = clone $dtStart->getDateTime();
// $component->DTEND->getDateTime() returns DateTimeImmutable
@ -839,7 +839,7 @@ class IMipService {
return $endDate->getTimestamp();
}
if(!$dtStart->hasTime()) {
if (!$dtStart->hasTime()) {
/** @var \DateTime $endDate */
// $component->DTSTART->getDateTime() returns DateTimeImmutable
$endDate = clone $dtStart->getDateTime();
@ -855,7 +855,7 @@ class IMipService {
* @param Property|null $attendee
*/
public function setL10n(?Property $attendee = null) {
if($attendee === null) {
if ($attendee === null) {
return;
}
@ -871,7 +871,7 @@ class IMipService {
* @return bool
*/
public function getAttendeeRsvpOrReqForParticipant(?Property $attendee = null) {
if($attendee === null) {
if ($attendee === null) {
return false;
}
@ -979,10 +979,10 @@ class IMipService {
htmlspecialchars($organizer->getNormalizedValue()),
htmlspecialchars($organizerName ?: $organizerEmail));
$organizerText = sprintf('%s <%s>', $organizerName, $organizerEmail);
if(isset($organizer['PARTSTAT'])) {
if (isset($organizer['PARTSTAT'])) {
/** @var Parameter $partstat */
$partstat = $organizer['PARTSTAT'];
if(strcasecmp($partstat->getValue(), 'ACCEPTED') === 0) {
if (strcasecmp($partstat->getValue(), 'ACCEPTED') === 0) {
$organizerHTML .= ' ✔︎';
$organizerText .= ' ✔︎';
}
@ -1154,7 +1154,7 @@ class IMipService {
public function isRoomOrResource(Property $attendee): bool {
$cuType = $attendee->offsetGet('CUTYPE');
if(!$cuType instanceof Parameter) {
if (!$cuType instanceof Parameter) {
return false;
}
$type = $cuType->getValue() ?? 'INDIVIDUAL';
@ -1178,7 +1178,7 @@ class IMipService {
$interval = $dateInterval->m;
$scale = 'month';
} elseif ($dateInterval->d >= 7) {
$interval = (int)($dateInterval->d / 7);
$interval = (int) ($dateInterval->d / 7);
$scale = 'week';
} elseif ($dateInterval->d > 0) {
$interval = $dateInterval->d;

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -23,6 +24,6 @@ class LimitFilter implements XmlDeserializable {
throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}limit has illegal value');
}
return (int)$value;
return (int) $value;
}
}

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -23,6 +24,6 @@ class OffsetFilter implements XmlDeserializable {
throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}offset has illegal value');
}
return (int)$value;
return (int) $value;
}
}

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -39,23 +39,23 @@ class StatusService {
public function processCalendarStatus(string $userId): void {
$user = $this->userManager->get($userId);
if($user === null) {
if ($user === null) {
return;
}
$availability = $this->availabilityCoordinator->getCurrentOutOfOfficeData($user);
if($availability !== null && $this->availabilityCoordinator->isInEffect($availability)) {
if ($availability !== null && $this->availabilityCoordinator->isInEffect($availability)) {
$this->logger->debug('An Absence is in effect, skipping calendar status check', ['user' => $userId]);
return;
}
$calendarEvents = $this->cache->get($userId);
if($calendarEvents === null) {
if ($calendarEvents === null) {
$calendarEvents = $this->getCalendarEvents($user);
$this->cache->set($userId, $calendarEvents, 300);
}
if(empty($calendarEvents)) {
if (empty($calendarEvents)) {
try {
$this->userStatusService->revertUserStatus($userId, IUserStatus::MESSAGE_CALENDAR_BUSY);
} catch (Exception $e) {
@ -81,7 +81,7 @@ class StatusService {
$currentStatus = null;
}
if(($currentStatus !== null && $currentStatus->getMessageId() === IUserStatus::MESSAGE_CALL)
if (($currentStatus !== null && $currentStatus->getMessageId() === IUserStatus::MESSAGE_CALL)
|| ($currentStatus !== null && $currentStatus->getStatus() === IUserStatus::DND)
|| ($currentStatus !== null && $currentStatus->getStatus() === IUserStatus::INVISIBLE)) {
// We don't overwrite the call status, DND status or Invisible status
@ -101,7 +101,7 @@ class StatusService {
if (isset($component['DTSTART']) && $userStatusTimestamp !== null) {
/** @var DateTimeImmutable $dateTime */
$dateTime = $component['DTSTART'][0];
if($dateTime instanceof DateTimeImmutable && $userStatusTimestamp > $dateTime->getTimestamp()) {
if ($dateTime instanceof DateTimeImmutable && $userStatusTimestamp > $dateTime->getTimestamp()) {
return false;
}
}
@ -112,7 +112,7 @@ class StatusService {
return true;
});
if(empty($applicableEvents)) {
if (empty($applicableEvents)) {
try {
$this->userStatusService->revertUserStatus($userId, IUserStatus::MESSAGE_CALENDAR_BUSY);
} catch (Exception $e) {
@ -130,7 +130,7 @@ class StatusService {
}
// Only update the status if it's neccesary otherwise we mess up the timestamp
if($currentStatus === null || $currentStatus->getMessageId() !== IUserStatus::MESSAGE_CALENDAR_BUSY) {
if ($currentStatus === null || $currentStatus->getMessageId() !== IUserStatus::MESSAGE_CALENDAR_BUSY) {
// One event that fulfills all status conditions is enough
// 1. Not an OOO event
// 2. Current user status (that is not a calendar status) was not set after the start of this event
@ -148,7 +148,7 @@ class StatusService {
private function getCalendarEvents(User $user): array {
$calendars = $this->calendarManager->getCalendarsForPrincipal('principals/users/' . $user->getUID());
if(empty($calendars)) {
if (empty($calendars)) {
return [];
}
@ -172,7 +172,7 @@ class StatusService {
$dtEnd = DateTimeImmutable::createFromMutable($this->timeFactory->getDateTime('+5 minutes'));
// Only query the calendars when there's any to search
if($query instanceof CalendarQuery && !empty($query->getCalendarUris())) {
if ($query instanceof CalendarQuery && !empty($query->getCalendarUris())) {
// Query the next hour
$query->setTimerangeStart($dtStart);
$query->setTimerangeEnd($dtEnd);

View file

@ -28,9 +28,9 @@ class Plugin extends ServerPlugin {
* @var string[]
*/
public const ENABLE_FOR_CLIENTS = [
"/^MSFT-WIN-3/",
"/Evolution/",
"/KIO/"
'/^MSFT-WIN-3/',
'/Evolution/',
'/KIO/'
];
/**

View file

@ -45,12 +45,12 @@ class RefreshWebcalService {
}
// Check the refresh rate if there is any
if(!empty($subscription['{http://apple.com/ns/ical/}refreshrate'])) {
if (!empty($subscription['{http://apple.com/ns/ical/}refreshrate'])) {
// add the refresh interval to the lastmodified timestamp
$refreshInterval = new \DateInterval($subscription['{http://apple.com/ns/ical/}refreshrate']);
$updateTime = $this->time->getDateTime();
$updateTime->setTimestamp($subscription['lastmodified'])->add($refreshInterval);
if($updateTime->getTimestamp() > $this->time->getTime()) {
if ($updateTime->getTimestamp() > $this->time->getTime()) {
return;
}
}
@ -131,7 +131,7 @@ class RefreshWebcalService {
try {
$objectUri = $this->getRandomCalendarObjectUri();
$this->calDavBackend->createCalendarObject($subscription['id'], $objectUri, $vObject->serialize(), CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION);
} catch (NoInstancesException | BadRequest $ex) {
} catch (NoInstancesException|BadRequest $ex) {
$this->logger->warning('Unable to create calendar object from subscription {subscriptionId}', ['exception' => $ex, 'subscriptionId' => $subscription['id'], 'source' => $subscription['source']]);
}
}
@ -143,7 +143,7 @@ class RefreshWebcalService {
return $dataSet['uri'];
}, $localData);
if(!empty($ids) && !empty($uris)) {
if (!empty($ids) && !empty($uris)) {
// Clean up on aisle 5
// The only events left over in the $localData array should be those that don't exist upstream
// All deleted VObjects from upstream are removed
@ -157,7 +157,7 @@ class RefreshWebcalService {
$this->updateSubscription($subscription, $mutations);
} catch (ParseException $ex) {
$this->logger->error("Subscription {subscriptionId} could not be refreshed due to a parsing error", ['exception' => $ex, 'subscriptionId' => $subscription['id']]);
$this->logger->error('Subscription {subscriptionId} could not be refreshed due to a parsing error', ['exception' => $ex, 'subscriptionId' => $subscription['id']]);
}
}

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2016 ownCloud GmbH
* SPDX-License-Identifier: AGPL-3.0-only

View file

@ -1,4 +1,5 @@
<?php
/**
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -38,8 +39,8 @@ class Filter implements IFilter {
/**
* @return int whether the filter should be rather on the top or bottom of
* the admin section. The filters are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
* the admin section. The filters are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
*/
public function getPriority(): int {
return 40;

View file

@ -21,7 +21,7 @@ abstract class Base implements IProvider {
/** @var IUserManager */
protected $userManager;
/** @var string[] */
/** @var string[] */
protected $userDisplayNames = [];
/** @var IGroupManager */
@ -55,14 +55,14 @@ abstract class Base implements IProvider {
$data['name'] === CardDavBackend::PERSONAL_ADDRESSBOOK_NAME) {
return [
'type' => 'addressbook',
'id' => (string)$data['id'],
'id' => (string) $data['id'],
'name' => $l->t('Personal'),
];
}
return [
'type' => 'addressbook',
'id' => (string)$data['id'],
'id' => (string) $data['id'],
'name' => $data['name'],
];
}

View file

@ -27,8 +27,8 @@ class Setting extends CalDAVSetting {
/**
* @return int whether the filter should be rather on the top or bottom of
* the admin section. The filters are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
* the admin section. The filters are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
*/
public function getPriority(): int {
return 50;

View file

@ -250,7 +250,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable, IMov
}
try {
return $this->carddavBackend->moveCard($sourceNode->getAddressbookId(), (int)$this->addressBookInfo['id'], $sourceNode->getUri(), $sourceNode->getOwner());
return $this->carddavBackend->moveCard($sourceNode->getAddressbookId(), (int) $this->addressBookInfo['id'], $sourceNode->getUri(), $sourceNode->getOwner());
} catch (Exception $e) {
// Avoid injecting LoggerInterface everywhere
Server::get(LoggerInterface::class)->error('Could not move calendar object: ' . $e->getMessage(), ['exception' => $e]);

View file

@ -91,19 +91,19 @@ class AddressBookImpl implements IAddressBookEnabled {
* @param string $pattern which should match within the $searchProperties
* @param array $searchProperties defines the properties within the query pattern should match
* @param array $options Options to define the output format and search behavior
* - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array
* example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']]
* - 'escape_like_param' - If set to false wildcards _ and % are not escaped
* - 'limit' - Set a numeric limit for the search results
* - 'offset' - Set the offset for the limited search results
* - 'wildcard' - Whether the search should use wildcards
* - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array
* example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']]
* - 'escape_like_param' - If set to false wildcards _ and % are not escaped
* - 'limit' - Set a numeric limit for the search results
* - 'offset' - Set the offset for the limited search results
* - 'wildcard' - Whether the search should use wildcards
* @psalm-param array{types?: bool, escape_like_param?: bool, limit?: int, offset?: int, wildcard?: bool} $options
* @return array an array of contacts which are arrays of key-value-pairs
* example result:
* [
* ['id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => 'a@b.c', 'GEO' => '37.386013;-122.082932'],
* ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['d@e.f', 'g@h.i']]
* ]
* example result:
* [
* ['id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => 'a@b.c', 'GEO' => '37.386013;-122.082932'],
* ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['d@e.f', 'g@h.i']]
* ]
* @since 5.0.0
*/
public function search($pattern, $searchProperties, $options) {
@ -144,13 +144,13 @@ class AddressBookImpl implements IAddressBookEnabled {
if (is_string($entry)) {
$property = $vCard->createProperty($key, $entry);
} else {
if (($key === "ADR" || $key === "PHOTO") && is_string($entry["value"])) {
$entry["value"] = stripslashes($entry["value"]);
$entry["value"] = explode(';', $entry["value"]);
if (($key === 'ADR' || $key === 'PHOTO') && is_string($entry['value'])) {
$entry['value'] = stripslashes($entry['value']);
$entry['value'] = explode(';', $entry['value']);
}
$property = $vCard->createProperty($key, $entry["value"]);
if (isset($entry["type"])) {
$property->add('TYPE', $entry["type"]);
$property = $vCard->createProperty($key, $entry['value']);
if (isset($entry['type'])) {
$property->add('TYPE', $entry['type']);
}
}
$vCard->add($property);
@ -353,7 +353,7 @@ class AddressBookImpl implements IAddressBookEnabled {
$path = 'addressbooks/users/' . $user . '/' . $uri;
$properties = $this->propertyMapper->findPropertyByPathAndName($user, $path, '{http://owncloud.org/ns}enabled');
if (count($properties) > 0) {
return (bool)$properties[0]->getPropertyvalue();
return (bool) $properties[0]->getPropertyvalue();
}
return true;
}

View file

@ -26,7 +26,7 @@ class Card extends \Sabre\CardDAV\Card {
}
public function getAddressbookId(): int {
return (int)$this->cardData['addressbookid'];
return (int) $this->cardData['addressbookid'];
}
public function getPrincipalUri(): string {

View file

@ -154,7 +154,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
continue;
}
$readOnly = (int)$row['access'] === Backend::ACCESS_READ;
$readOnly = (int) $row['access'] === Backend::ACCESS_READ;
if (isset($addressBooks[$row['id']])) {
if ($readOnly) {
// New share can not have more permissions then the old one.
@ -330,14 +330,14 @@ class CardDavBackend implements BackendInterface, SyncSupport {
$query->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId)))
->executeStatement();
$this->addChange($addressBookId, "", 2);
$this->addChange($addressBookId, '', 2);
$addressBookRow = $this->getAddressBookById((int)$addressBookId);
$shares = $this->getShares((int)$addressBookId);
$addressBookRow = $this->getAddressBookById((int) $addressBookId);
$shares = $this->getShares((int) $addressBookId);
return [$addressBookRow, $shares];
}, $this->db);
$this->dispatcher->dispatchTyped(new AddressBookUpdatedEvent((int)$addressBookId, $addressBookRow, $shares, $mutations));
$this->dispatcher->dispatchTyped(new AddressBookUpdatedEvent((int) $addressBookId, $addressBookRow, $shares, $mutations));
return true;
});
@ -417,7 +417,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
*/
public function deleteAddressBook($addressBookId) {
$this->atomic(function () use ($addressBookId) {
$addressBookId = (int)$addressBookId;
$addressBookId = (int) $addressBookId;
$addressBookData = $this->getAddressBookById($addressBookId);
$shares = $this->getShares($addressBookId);
@ -616,7 +616,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
->andWhere($q->expr()->eq('uid', $q->createNamedParameter($uid)))
->setMaxResults(1);
$result = $q->executeQuery();
$count = (bool)$result->fetchOne();
$count = (bool) $result->fetchOne();
$result->closeCursor();
if ($count) {
throw new \Sabre\DAV\Exception\BadRequest('VCard object with uid already exists in this addressbook collection.');
@ -729,7 +729,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
->andWhere($query->expr()->eq('addressbookid', $query->createNamedParameter($sourceAddressBookId, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT))
->executeStatement();
$this->purgeProperties($sourceAddressBookId, (int)$card['id']);
$this->purgeProperties($sourceAddressBookId, (int) $card['id']);
$this->updateProperties($sourceAddressBookId, $card['uri'], $card['carddata']);
$this->addChange($sourceAddressBookId, $card['uri'], 3);
@ -945,7 +945,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
->from('addressbooks')
->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId)));
$result = $query->executeQuery();
$syncToken = (int)$result->fetchOne();
$syncToken = (int) $result->fetchOne();
$result->closeCursor();
$query = $this->db->getQueryBuilder();
@ -1032,11 +1032,11 @@ class CardDavBackend implements BackendInterface, SyncSupport {
* @param string $pattern which should match within the $searchProperties
* @param array $searchProperties defines the properties within the query pattern should match
* @param array $options = array() to define the search behavior
* - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array
* - 'escape_like_param' - If set to false wildcards _ and % are not escaped, otherwise they are
* - 'limit' - Set a numeric limit for the search results
* - 'offset' - Set the offset for the limited search results
* - 'wildcard' - Whether the search should use wildcards
* - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array
* - 'escape_like_param' - If set to false wildcards _ and % are not escaped, otherwise they are
* - 'limit' - Set a numeric limit for the search results
* - 'offset' - Set the offset for the limited search results
* - 'wildcard' - Whether the search should use wildcards
* @psalm-param array{types?: bool, escape_like_param?: bool, limit?: int, offset?: int, wildcard?: bool} $options
* @return array an array of contacts which are arrays of key-value-pairs
*/
@ -1169,7 +1169,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
$matches = $result->fetchAll();
$result->closeCursor();
$matches = array_map(function ($match) {
return (int)$match['cardid'];
return (int) $match['cardid'];
}, $matches);
$cards = [];
@ -1370,7 +1370,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
throw new \InvalidArgumentException('Card does not exists: ' . $uri);
}
return (int)$cardIds['id'];
return (int) $cardIds['id'];
}
/**

View file

@ -13,13 +13,13 @@ use OCP\IL10N;
use OCP\IURLGenerator;
class ContactsManager {
/** @var CardDavBackend */
/** @var CardDavBackend */
private $backend;
/** @var IL10N */
/** @var IL10N */
private $l10n;
/** @var PropertyMapper */
/** @var PropertyMapper */
private $propertyMapper;
/**
@ -51,7 +51,7 @@ class ContactsManager {
* @param IURLGenerator $urlGenerator
*/
public function setupSystemContactsProvider(IManager $cm, ?string $userId, IURLGenerator $urlGenerator) {
$addressBooks = $this->backend->getAddressBooksForUser("principals/system/system");
$addressBooks = $this->backend->getAddressBooksForUser('principals/system/system');
$this->register($cm, $addressBooks, $urlGenerator, $userId);
}

View file

@ -55,7 +55,7 @@ class ImageExportPlugin extends ServerPlugin {
return true;
}
$size = isset($queryParams['size']) ? (int)$queryParams['size'] : -1;
$size = isset($queryParams['size']) ? (int) $queryParams['size'] : -1;
$path = $request->getPath();
$node = $this->server->tree->getNodeForPath($path);

Some files were not shown because too many files have changed in this diff Show more