Unify function spacing to PSR2 recommendation
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
19e97e86c6
commit
afbd9c4e6e
|
@ -247,7 +247,7 @@ class AccessibilityController extends Controller {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getUserValues(): array{
|
||||
private function getUserValues(): array {
|
||||
$userTheme = $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'theme', false);
|
||||
$userFont = $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'font', false);
|
||||
$userHighContrast = $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'highcontrast', false);
|
||||
|
|
|
@ -116,7 +116,7 @@ class ConfigController extends OCSController {
|
|||
$highcontrast = [$this->accessibilityProvider->getHighContrast()];
|
||||
$fonts = $this->accessibilityProvider->getFonts();
|
||||
|
||||
$availableOptions = array_map(function($option) {
|
||||
$availableOptions = array_map(function ($option) {
|
||||
return $option['id'];
|
||||
}, array_merge($themes, $highcontrast, $fonts));
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ class RepairUserConfig implements IRepairStep {
|
|||
*/
|
||||
public function run(IOutput $output) {
|
||||
$output->startProgress();
|
||||
$this->userManager->callForSeenUsers(function(IUser $user) use ($output) {
|
||||
$this->userManager->callForSeenUsers(function (IUser $user) use ($output) {
|
||||
$theme = $this->config->getUserValue($user->getUID(), Application::APP_NAME, 'theme', false);
|
||||
if ($theme === 'themedark') {
|
||||
$this->config->setUserValue($user->getUID(), Application::APP_NAME, 'theme', 'dark');
|
||||
|
|
|
@ -154,15 +154,15 @@ class Application extends App {
|
|||
protected function appHooks() {
|
||||
|
||||
$eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher();
|
||||
$eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE, function(ManagerEvent $event) {
|
||||
$eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE, function (ManagerEvent $event) {
|
||||
$appActions = new AppManagement($this->logger);
|
||||
$appActions->enableApp($event->getAppID());
|
||||
});
|
||||
$eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE_FOR_GROUPS, function(ManagerEvent $event) {
|
||||
$eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE_FOR_GROUPS, function (ManagerEvent $event) {
|
||||
$appActions = new AppManagement($this->logger);
|
||||
$appActions->enableAppForGroups($event->getAppID(), $event->getGroups());
|
||||
});
|
||||
$eventDispatcher->addListener(ManagerEvent::EVENT_APP_DISABLE, function(ManagerEvent $event) {
|
||||
$eventDispatcher->addListener(ManagerEvent::EVENT_APP_DISABLE, function (ManagerEvent $event) {
|
||||
$appActions = new AppManagement($this->logger);
|
||||
$appActions->disableApp($event->getAppID());
|
||||
});
|
||||
|
@ -171,7 +171,7 @@ class Application extends App {
|
|||
|
||||
protected function consoleHooks() {
|
||||
$eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher();
|
||||
$eventDispatcher->addListener(ConsoleEvent::EVENT_RUN, function(ConsoleEvent $event) {
|
||||
$eventDispatcher->addListener(ConsoleEvent::EVENT_RUN, function (ConsoleEvent $event) {
|
||||
$appActions = new Console($this->logger);
|
||||
$appActions->runCommand($event->getArguments());
|
||||
});
|
||||
|
@ -182,7 +182,7 @@ class Application extends App {
|
|||
$eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher();
|
||||
$eventDispatcher->addListener(
|
||||
IPreview::EVENT,
|
||||
function(GenericEvent $event) use ($fileActions) {
|
||||
function (GenericEvent $event) use ($fileActions) {
|
||||
/** @var File $file */
|
||||
$file = $event->getSubject();
|
||||
$fileActions->preview([
|
||||
|
@ -253,11 +253,11 @@ class Application extends App {
|
|||
|
||||
protected function securityHooks() {
|
||||
$eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher();
|
||||
$eventDispatcher->addListener(IProvider::EVENT_SUCCESS, function(GenericEvent $event) {
|
||||
$eventDispatcher->addListener(IProvider::EVENT_SUCCESS, function (GenericEvent $event) {
|
||||
$security = new Security($this->logger);
|
||||
$security->twofactorSuccess($event->getSubject(), $event->getArguments());
|
||||
});
|
||||
$eventDispatcher->addListener(IProvider::EVENT_FAILED, function(GenericEvent $event) {
|
||||
$eventDispatcher->addListener(IProvider::EVENT_FAILED, function (GenericEvent $event) {
|
||||
$security = new Security($this->logger);
|
||||
$security->twofactorFailed($event->getSubject(), $event->getArguments());
|
||||
});
|
||||
|
|
|
@ -45,7 +45,7 @@ class Application extends App {
|
|||
|
||||
const APP_ID = 'comments';
|
||||
|
||||
public function __construct (array $urlParams = []) {
|
||||
public function __construct(array $urlParams = []) {
|
||||
parent::__construct(self::APP_ID, $urlParams);
|
||||
$container = $this->getContainer();
|
||||
|
||||
|
@ -77,8 +77,8 @@ class Application extends App {
|
|||
}
|
||||
|
||||
protected function registerDavEntity(IEventDispatcher $dispatcher) {
|
||||
$dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) {
|
||||
$event->addEntityCollection('files', function($name) {
|
||||
$dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function (CommentsEntityEvent $event) {
|
||||
$event->addEntityCollection('files', function ($name) {
|
||||
$nodes = \OC::$server->getUserFolder()->getById((int)$name);
|
||||
return !empty($nodes);
|
||||
});
|
||||
|
|
|
@ -60,7 +60,7 @@ class CommentersSorter implements ISorter {
|
|||
// at least on PHP 5.6 usort turned out to be not stable. So we add
|
||||
// the current index to the value and compare it on a draw
|
||||
$i = 0;
|
||||
$workArray = array_map(function($element) use (&$i) {
|
||||
$workArray = array_map(function ($element) use (&$i) {
|
||||
return [$i++, $element];
|
||||
}, $byType);
|
||||
|
||||
|
|
|
@ -39,14 +39,14 @@ use Symfony\Component\EventDispatcher\GenericEvent;
|
|||
$app = \OC::$server->query(Application::class);
|
||||
$app->registerHooks();
|
||||
|
||||
\OC::$server->registerService('CardDAVSyncService', function() use ($app) {
|
||||
\OC::$server->registerService('CardDAVSyncService', function () use ($app) {
|
||||
return $app->getSyncService();
|
||||
});
|
||||
|
||||
$eventDispatcher = \OC::$server->getEventDispatcher();
|
||||
|
||||
$eventDispatcher->addListener('OCP\Federation\TrustedServerEvent::remove',
|
||||
function(GenericEvent $event) use ($app) {
|
||||
function (GenericEvent $event) use ($app) {
|
||||
/** @var CardDavBackend $cardDavBackend */
|
||||
$cardDavBackend = $app->getContainer()->query(CardDavBackend::class);
|
||||
$addressBookUri = $event->getSubject();
|
||||
|
@ -58,7 +58,7 @@ $eventDispatcher->addListener('OCP\Federation\TrustedServerEvent::remove',
|
|||
);
|
||||
|
||||
$eventDispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createSubscription',
|
||||
function(GenericEvent $event) use ($app) {
|
||||
function (GenericEvent $event) use ($app) {
|
||||
$jobList = $app->getContainer()->getServer()->getJobList();
|
||||
$subscriptionData = $event->getArgument('subscriptionData');
|
||||
|
||||
|
@ -77,7 +77,7 @@ $eventDispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createSubscription
|
|||
);
|
||||
|
||||
$eventDispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription',
|
||||
function(GenericEvent $event) use ($app) {
|
||||
function (GenericEvent $event) use ($app) {
|
||||
$jobList = $app->getContainer()->getServer()->getJobList();
|
||||
$subscriptionData = $event->getArgument('subscriptionData');
|
||||
|
||||
|
@ -92,7 +92,7 @@ $eventDispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription
|
|||
}
|
||||
);
|
||||
|
||||
$eventHandler = function() use ($app) {
|
||||
$eventHandler = function () use ($app) {
|
||||
try {
|
||||
$job = $app->getContainer()->query(\OCA\DAV\BackgroundJob\UpdateCalendarResourcesRoomsBackgroundJob::class);
|
||||
$job->run([]);
|
||||
|
@ -106,7 +106,7 @@ $eventDispatcher->addListener('\OCP\Calendar\Resource\ForceRefreshEvent', $event
|
|||
$eventDispatcher->addListener('\OCP\Calendar\Room\ForceRefreshEvent', $eventHandler);
|
||||
|
||||
$cm = \OC::$server->getContactsManager();
|
||||
$cm->register(function() use ($cm, $app) {
|
||||
$cm->register(function () use ($cm, $app) {
|
||||
$user = \OC::$server->getUserSession()->getUser();
|
||||
if (!is_null($user)) {
|
||||
$app->setupContactsProvider($cm, $user->getUID());
|
||||
|
@ -116,7 +116,7 @@ $cm->register(function() use ($cm, $app) {
|
|||
});
|
||||
|
||||
$calendarManager = \OC::$server->getCalendarManager();
|
||||
$calendarManager->register(function() use ($calendarManager, $app) {
|
||||
$calendarManager->register(function () use ($calendarManager, $app) {
|
||||
$user = \OC::$server->getUserSession()->getUser();
|
||||
if ($user !== null) {
|
||||
$app->setupCalendarProvider($calendarManager, $user->getUID());
|
||||
|
|
|
@ -68,7 +68,7 @@ $authPlugin->addBackend($bearerAuthPlugin);
|
|||
|
||||
$requestUri = \OC::$server->getRequest()->getRequestUri();
|
||||
|
||||
$server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, function() {
|
||||
$server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, function () {
|
||||
// use the view for the logged in user
|
||||
return \OC\Files\Filesystem::getView();
|
||||
});
|
||||
|
|
|
@ -65,7 +65,7 @@ class Application extends App {
|
|||
$container = $this->getContainer();
|
||||
$server = $container->getServer();
|
||||
|
||||
$container->registerService(PhotoCache::class, function(SimpleContainer $s) use ($server) {
|
||||
$container->registerService(PhotoCache::class, function (SimpleContainer $s) use ($server) {
|
||||
return new PhotoCache(
|
||||
$server->getAppDataDir('dav-photocache'),
|
||||
$server->getLogger()
|
||||
|
@ -147,7 +147,7 @@ class Application extends App {
|
|||
}
|
||||
});
|
||||
|
||||
$clearPhotoCache = function($event) {
|
||||
$clearPhotoCache = function ($event) {
|
||||
if ($event instanceof GenericEvent) {
|
||||
/** @var PhotoCache $p */
|
||||
$p = $this->getContainer()->query(PhotoCache::class);
|
||||
|
@ -160,20 +160,20 @@ class Application extends App {
|
|||
$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $clearPhotoCache);
|
||||
$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', $clearPhotoCache);
|
||||
|
||||
$dispatcher->addListener('OC\AccountManager::userUpdated', function(GenericEvent $event) {
|
||||
$dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) {
|
||||
$user = $event->getSubject();
|
||||
$syncService = $this->getContainer()->query(SyncService::class);
|
||||
$syncService->updateUser($user);
|
||||
});
|
||||
|
||||
$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', function(GenericEvent $event) {
|
||||
$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', function (GenericEvent $event) {
|
||||
/** @var Backend $backend */
|
||||
$backend = $this->getContainer()->query(Backend::class);
|
||||
$backend->onCalendarAdd(
|
||||
$event->getArgument('calendarData')
|
||||
);
|
||||
});
|
||||
$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', function(GenericEvent $event) {
|
||||
$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', function (GenericEvent $event) {
|
||||
/** @var Backend $backend */
|
||||
$backend = $this->getContainer()->query(Backend::class);
|
||||
$backend->onCalendarUpdate(
|
||||
|
@ -182,7 +182,7 @@ class Application extends App {
|
|||
$event->getArgument('propertyMutations')
|
||||
);
|
||||
});
|
||||
$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', function(GenericEvent $event) {
|
||||
$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', function (GenericEvent $event) {
|
||||
/** @var Backend $backend */
|
||||
$backend = $this->getContainer()->query(Backend::class);
|
||||
$backend->onCalendarDelete(
|
||||
|
@ -195,7 +195,7 @@ class Application extends App {
|
|||
$event->getArgument('calendarId')
|
||||
);
|
||||
});
|
||||
$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateShares', function(GenericEvent $event) {
|
||||
$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateShares', function (GenericEvent $event) {
|
||||
/** @var Backend $backend */
|
||||
$backend = $this->getContainer()->query(Backend::class);
|
||||
$backend->onCalendarUpdateShares(
|
||||
|
@ -208,7 +208,7 @@ class Application extends App {
|
|||
// Here we should recalculate if reminders should be sent to new or old sharees
|
||||
});
|
||||
|
||||
$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', function(GenericEvent $event) {
|
||||
$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', function (GenericEvent $event) {
|
||||
/** @var Backend $backend */
|
||||
$backend = $this->getContainer()->query(Backend::class);
|
||||
$backend->onCalendarPublication(
|
||||
|
@ -217,7 +217,7 @@ class Application extends App {
|
|||
);
|
||||
});
|
||||
|
||||
$listener = function(GenericEvent $event, $eventName) {
|
||||
$listener = function (GenericEvent $event, $eventName) {
|
||||
/** @var Backend $backend */
|
||||
$backend = $this->getContainer()->query(Backend::class);
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@ class PluginManager {
|
|||
* @param string[] $plugin
|
||||
*/
|
||||
private function loadSabreAddressBookPluginsFromInfoXml(array $plugins): void {
|
||||
$providers = array_map(function(string $className): IAddressBookProvider {
|
||||
$providers = array_map(function (string $className): IAddressBookProvider {
|
||||
$instance = $this->createPluginInstance($className);
|
||||
if (!($instance instanceof IAddressBookProvider)) {
|
||||
throw new \Exception("Sabre address book plugin class '$className' does not implement the \OCA\DAV\CardDAV\Integration\IAddressBookProvider interface");
|
||||
|
|
|
@ -57,7 +57,7 @@ class RegisterRegenerateBirthdayCalendars extends QueuedJob {
|
|||
* @inheritDoc
|
||||
*/
|
||||
public function run($argument) {
|
||||
$this->userManager->callForSeenUsers(function(IUser $user) {
|
||||
$this->userManager->callForSeenUsers(function (IUser $user) {
|
||||
$this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [
|
||||
'userId' => $user->getUID(),
|
||||
'purgeBeforeGenerating' => true
|
||||
|
|
|
@ -398,7 +398,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|||
->where($query->expr()->eq('backend_id', $query->createNamedParameter($backendId)));
|
||||
$stmt = $query->execute();
|
||||
|
||||
return array_map(function($row) {
|
||||
return array_map(function ($row) {
|
||||
return $row['resource_id'];
|
||||
}, $stmt->fetchAll(\PDO::FETCH_NAMED));
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ class UploadCleanup extends TimedJob {
|
|||
// The folder has to be more than a day old
|
||||
$initial = $uploadFolder->getMTime() < $time;
|
||||
|
||||
$expire = array_reduce($files, function(bool $carry, File $file) use ($time) {
|
||||
$expire = array_reduce($files, function (bool $carry, File $file) use ($time) {
|
||||
return $carry && $file->getMTime() < $time;
|
||||
}, $initial);
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
|
||||
$principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal));
|
||||
|
||||
$principals = array_map(function($principal) {
|
||||
$principals = array_map(function ($principal) {
|
||||
return urldecode($principal);
|
||||
}, $principals);
|
||||
$principals[]= $principalUri;
|
||||
|
@ -800,7 +800,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
/**
|
||||
* @suppress SqlInjectionChecker
|
||||
*/
|
||||
$propPatch->handle($supportedProperties, function($mutations) use ($calendarId) {
|
||||
$propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) {
|
||||
$newValues = [];
|
||||
foreach ($mutations as $propertyName => $propertyValue) {
|
||||
|
||||
|
@ -1587,7 +1587,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$result = $outerQuery->execute();
|
||||
$calendarObjects = $result->fetchAll();
|
||||
|
||||
return array_map(function($o) {
|
||||
return array_map(function ($o) {
|
||||
$calendarData = Reader::read($o['calendardata']);
|
||||
$comps = $calendarData->getComponents();
|
||||
$objects = [];
|
||||
|
@ -1605,10 +1605,10 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'type' => $o['componenttype'],
|
||||
'uid' => $o['uid'],
|
||||
'uri' => $o['uri'],
|
||||
'objects' => array_map(function($c) {
|
||||
'objects' => array_map(function ($c) {
|
||||
return $this->transformSearchData($c);
|
||||
}, $objects),
|
||||
'timezones' => array_map(function($c) {
|
||||
'timezones' => array_map(function ($c) {
|
||||
return $this->transformSearchData($c);
|
||||
}, $timezones),
|
||||
];
|
||||
|
@ -1624,7 +1624,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
/** @var Component[] $subComponents */
|
||||
$subComponents = $comp->getComponents();
|
||||
/** @var Property[] $properties */
|
||||
$properties = array_filter($comp->children(), function($c) {
|
||||
$properties = array_filter($comp->children(), function ($c) {
|
||||
return $c instanceof Property;
|
||||
});
|
||||
$validationRules = $comp->getValidationRules();
|
||||
|
@ -1993,7 +1993,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
/**
|
||||
* @suppress SqlInjectionChecker
|
||||
*/
|
||||
$propPatch->handle($supportedProperties, function($mutations) use ($subscriptionId) {
|
||||
$propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) {
|
||||
|
||||
$newValues = [];
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
|
|||
parent::getOwner(),
|
||||
'principals/system/public'
|
||||
];
|
||||
return array_filter($acl, function($rule) use ($allowedPrincipals) {
|
||||
return array_filter($acl, function ($rule) use ($allowedPrincipals) {
|
||||
return \in_array($rule['principal'], $allowedPrincipals, true);
|
||||
});
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
|
|||
$this->calendarInfo['{http://owncloud.org/ns}owner-principal'] !== $this->calendarInfo['principaluri']) {
|
||||
$principal = 'principal:' . parent::getOwner();
|
||||
$shares = $this->caldavBackend->getShares($this->getResourceId());
|
||||
$shares = array_filter($shares, function($share) use ($principal){
|
||||
$shares = array_filter($shares, function ($share) use ($principal) {
|
||||
return $share['href'] === $principal;
|
||||
});
|
||||
if (empty($shares)) {
|
||||
|
|
|
@ -128,7 +128,7 @@ class PublishPlugin extends ServerPlugin {
|
|||
}
|
||||
});
|
||||
|
||||
$propFind->handle('{'.self::NS_CALENDARSERVER.'}allowed-sharing-modes', function() use ($node) {
|
||||
$propFind->handle('{'.self::NS_CALENDARSERVER.'}allowed-sharing-modes', function () use ($node) {
|
||||
$canShare = (!$node->isSubscription() && $node->canWrite());
|
||||
$canPublish = (!$node->isSubscription() && $node->canWrite());
|
||||
|
||||
|
|
|
@ -727,7 +727,7 @@ class ReminderService {
|
|||
* @return VObject\Component\VEvent[]
|
||||
*/
|
||||
private function getRecurrenceExceptionFromListOfVEvents(array $vevents):array {
|
||||
return array_values(array_filter($vevents, function(VEvent $vevent) {
|
||||
return array_values(array_filter($vevents, function (VEvent $vevent) {
|
||||
return $vevent->{'RECURRENCE-ID'} !== null;
|
||||
}));
|
||||
}
|
||||
|
@ -737,7 +737,7 @@ class ReminderService {
|
|||
* @return VEvent|null
|
||||
*/
|
||||
private function getMasterItemFromListOfVEvents(array $vevents):?VEvent {
|
||||
$elements = array_values(array_filter($vevents, function(VEvent $vevent) {
|
||||
$elements = array_values(array_filter($vevents, function (VEvent $vevent) {
|
||||
return $vevent->{'RECURRENCE-ID'} === null;
|
||||
}));
|
||||
|
||||
|
|
|
@ -305,11 +305,11 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
|||
|
||||
default:
|
||||
$rowsByMetadata = $this->searchPrincipalsByMetadataKey($prop, $value);
|
||||
$filteredRows = array_filter($rowsByMetadata, function($row) use ($usersGroups) {
|
||||
$filteredRows = array_filter($rowsByMetadata, function ($row) use ($usersGroups) {
|
||||
return $this->isAllowedToAccessResource($row, $usersGroups);
|
||||
});
|
||||
|
||||
$results[] = array_map(function($row) {
|
||||
$results[] = array_map(function ($row) {
|
||||
return $row['uri'];
|
||||
}, $filteredRows);
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ EOF;
|
|||
*/
|
||||
function propFindDefaultCalendarUrl(PropFind $propFind, INode $node) {
|
||||
if ($node instanceof IPrincipal) {
|
||||
$propFind->handle('{' . self::NS_CALDAV . '}schedule-default-calendar-URL', function() use ($node) {
|
||||
$propFind->handle('{' . self::NS_CALDAV . '}schedule-default-calendar-URL', function () use ($node) {
|
||||
/** @var \OCA\DAV\CalDAV\Plugin $caldavPlugin */
|
||||
$caldavPlugin = $this->server->getPlugin('caldav');
|
||||
$principalUrl = $node->getPrincipalUrl();
|
||||
|
|
|
@ -166,7 +166,7 @@ class RefreshWebcalService {
|
|||
public function getSubscription(string $principalUri, string $uri) {
|
||||
$subscriptions = array_values(array_filter(
|
||||
$this->calDavBackend->getSubscriptionsForUser($principalUri),
|
||||
function($sub) use ($uri) {
|
||||
function ($sub) use ($uri) {
|
||||
return $sub['uri'] === $uri;
|
||||
}
|
||||
));
|
||||
|
@ -197,7 +197,7 @@ class RefreshWebcalService {
|
|||
->withHeader('Accept', 'text/calendar, application/calendar+json, application/calendar+xml')
|
||||
->withHeader('User-Agent', 'Nextcloud Webcal Crawler');
|
||||
}));
|
||||
$handlerStack->push(Middleware::mapResponse(function(ResponseInterface $response) use (&$didBreak301Chain, &$latestLocation) {
|
||||
$handlerStack->push(Middleware::mapResponse(function (ResponseInterface $response) use (&$didBreak301Chain, &$latestLocation) {
|
||||
if (!$didBreak301Chain) {
|
||||
if ($response->getStatusCode() !== 301) {
|
||||
$didBreak301Chain = true;
|
||||
|
|
|
@ -145,7 +145,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable {
|
|||
|
||||
$acl = $this->carddavBackend->applyShareAcl($this->getResourceId(), $acl);
|
||||
$allowedPrincipals = [$this->getOwner(), parent::getOwner(), 'principals/system/system'];
|
||||
return array_filter($acl, function($rule) use ($allowedPrincipals) {
|
||||
return array_filter($acl, function ($rule) use ($allowedPrincipals) {
|
||||
return \in_array($rule['principal'], $allowedPrincipals, true);
|
||||
});
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable {
|
|||
if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) {
|
||||
$principal = 'principal:' . parent::getOwner();
|
||||
$shares = $this->carddavBackend->getShares($this->getResourceId());
|
||||
$shares = array_filter($shares, function($share) use ($principal){
|
||||
$shares = array_filter($shares, function ($share) use ($principal) {
|
||||
return $share['href'] === $principal;
|
||||
});
|
||||
if (empty($shares)) {
|
||||
|
|
|
@ -174,7 +174,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
$principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
|
||||
$principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal));
|
||||
|
||||
$principals = array_map(function($principal) {
|
||||
$principals = array_map(function ($principal) {
|
||||
return urldecode($principal);
|
||||
}, $principals);
|
||||
$principals[]= $principalUri;
|
||||
|
@ -363,7 +363,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
/**
|
||||
* @suppress SqlInjectionChecker
|
||||
*/
|
||||
$propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) {
|
||||
$propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) {
|
||||
|
||||
$updates = [];
|
||||
foreach($mutations as $property=>$newValue) {
|
||||
|
@ -939,7 +939,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
|
||||
$result->closeCursor();
|
||||
|
||||
return array_map(function($array) {
|
||||
return array_map(function ($array) {
|
||||
$array['carddata'] = $this->readBlob($array['carddata']);
|
||||
return $array;
|
||||
}, $cards);
|
||||
|
|
|
@ -322,7 +322,7 @@ class SyncService {
|
|||
|
||||
public function syncInstance(\Closure $progressCallback = null) {
|
||||
$systemAddressBook = $this->getLocalSystemAddressBook();
|
||||
$this->userManager->callForSeenUsers(function($user) use ($systemAddressBook, $progressCallback) {
|
||||
$this->userManager->callForSeenUsers(function ($user) use ($systemAddressBook, $progressCallback) {
|
||||
$this->updateUser($user);
|
||||
if (!is_null($progressCallback)) {
|
||||
$progressCallback();
|
||||
|
|
|
@ -72,7 +72,7 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome {
|
|||
|
||||
$addressBooks = $this->carddavBackend->getAddressBooksForUser($this->principalUri);
|
||||
/** @var IAddressBook[] $objects */
|
||||
$objects = array_map(function(array $addressBook) {
|
||||
$objects = array_map(function (array $addressBook) {
|
||||
if ($addressBook['principaluri'] === 'principals/system/system') {
|
||||
return new SystemAddressbook($this->carddavBackend, $addressBook, $this->l10n, $this->config);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome {
|
|||
return new AddressBook($this->carddavBackend, $addressBook, $this->l10n);
|
||||
}, $addressBooks);
|
||||
/** @var IAddressBook[][] $objectsFromPlugins */
|
||||
$objectsFromPlugins = array_map(function(IAddressBookProvider $plugin): array {
|
||||
$objectsFromPlugins = array_map(function (IAddressBookProvider $plugin): array {
|
||||
return $plugin->fetchAllForAddressBookHome($this->principalUri);
|
||||
}, $this->pluginManager->getAddressBookPlugins());
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ class SyncBirthdayCalendar extends Command {
|
|||
$output->writeln("Start birthday calendar sync for all users ...");
|
||||
$p = new ProgressBar($output);
|
||||
$p->start();
|
||||
$this->userManager->callForSeenUsers(function($user) use ($p) {
|
||||
$this->userManager->callForSeenUsers(function ($user) use ($p) {
|
||||
$p->advance();
|
||||
|
||||
$userId = $user->getUID();
|
||||
|
@ -113,7 +113,7 @@ class SyncBirthdayCalendar extends Command {
|
|||
$output->writeln('');
|
||||
}
|
||||
|
||||
protected function verifyEnabled () {
|
||||
protected function verifyEnabled() {
|
||||
$isEnabled = $this->config->getAppValue('dav', 'generateBirthdayCalendar', 'yes');
|
||||
|
||||
if ($isEnabled !== 'yes') {
|
||||
|
|
|
@ -56,7 +56,7 @@ class SyncSystemAddressBook extends Command {
|
|||
$output->writeln('Syncing users ...');
|
||||
$progress = new ProgressBar($output);
|
||||
$progress->start();
|
||||
$this->syncService->syncInstance(function() use ($progress) {
|
||||
$this->syncService->syncInstance(function () use ($progress) {
|
||||
$progress->advance();
|
||||
});
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
|
|||
$this->logger = $logger;
|
||||
|
||||
$methods = get_class_methods($this->comment);
|
||||
$methods = array_filter($methods, function($name){
|
||||
$methods = array_filter($methods, function ($name) {
|
||||
return strpos($name, 'get') === 0;
|
||||
});
|
||||
foreach($methods as $getter) {
|
||||
|
@ -283,7 +283,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
|
|||
* @return array
|
||||
*/
|
||||
protected function composeMentionsPropertyValue() {
|
||||
return array_map(function($mention) {
|
||||
return array_map(function ($mention) {
|
||||
try {
|
||||
$displayName = $this->commentsManager->resolveDisplayName($mention['type'], $mention['id']);
|
||||
} catch (\OutOfBoundsException $e) {
|
||||
|
|
|
@ -91,7 +91,7 @@ class CommentsPlugin extends ServerPlugin {
|
|||
|
||||
$this->server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc';
|
||||
|
||||
$this->server->xml->classMap['DateTime'] = function(Writer $writer, \DateTime $value) {
|
||||
$this->server->xml->classMap['DateTime'] = function (Writer $writer, \DateTime $value) {
|
||||
$writer->write(\Sabre\HTTP\toDate($value));
|
||||
};
|
||||
|
||||
|
|
|
@ -99,15 +99,15 @@ class CommentPropertiesPlugin extends ServerPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
$propFind->handle(self::PROPERTY_NAME_COUNT, function() use ($node) {
|
||||
$propFind->handle(self::PROPERTY_NAME_COUNT, function () use ($node) {
|
||||
return $this->commentsManager->getNumberOfCommentsForObject('files', (string)$node->getId());
|
||||
});
|
||||
|
||||
$propFind->handle(self::PROPERTY_NAME_HREF, function() use ($node) {
|
||||
$propFind->handle(self::PROPERTY_NAME_HREF, function () use ($node) {
|
||||
return $this->getCommentsLink($node);
|
||||
});
|
||||
|
||||
$propFind->handle(self::PROPERTY_NAME_UNREAD, function() use ($node) {
|
||||
$propFind->handle(self::PROPERTY_NAME_UNREAD, function () use ($node) {
|
||||
if (isset($this->cachedUnreadCount[$node->getId()])) {
|
||||
return $this->cachedUnreadCount[$node->getId()];
|
||||
} else {
|
||||
|
|
|
@ -89,10 +89,10 @@ class FakeLockerPlugin extends ServerPlugin {
|
|||
* @return void
|
||||
*/
|
||||
function propFind(PropFind $propFind, INode $node) {
|
||||
$propFind->handle('{DAV:}supportedlock', function() {
|
||||
$propFind->handle('{DAV:}supportedlock', function () {
|
||||
return new SupportedLock(true);
|
||||
});
|
||||
$propFind->handle('{DAV:}lockdiscovery', function() use ($propFind) {
|
||||
$propFind->handle('{DAV:}lockdiscovery', function () use ($propFind) {
|
||||
return new LockDiscovery([]);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ class FilesPlugin extends ServerPlugin {
|
|||
$this->server->on('afterWriteContent', [$this, 'sendFileIdHeader']);
|
||||
$this->server->on('afterMethod:GET', [$this,'httpGet']);
|
||||
$this->server->on('afterMethod:GET', [$this, 'handleDownloadToken']);
|
||||
$this->server->on('afterResponse', function($request, ResponseInterface $response) {
|
||||
$this->server->on('afterResponse', function ($request, ResponseInterface $response) {
|
||||
$body = $response->getBody();
|
||||
if (is_resource($body)) {
|
||||
fclose($body);
|
||||
|
@ -305,15 +305,15 @@ class FilesPlugin extends ServerPlugin {
|
|||
* }
|
||||
*/
|
||||
|
||||
$propFind->handle(self::FILEID_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::FILEID_PROPERTYNAME, function () use ($node) {
|
||||
return $node->getFileId();
|
||||
});
|
||||
|
||||
$propFind->handle(self::INTERNAL_FILEID_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::INTERNAL_FILEID_PROPERTYNAME, function () use ($node) {
|
||||
return $node->getInternalFileId();
|
||||
});
|
||||
|
||||
$propFind->handle(self::PERMISSIONS_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::PERMISSIONS_PROPERTYNAME, function () use ($node) {
|
||||
$perms = $node->getDavPermissions();
|
||||
if ($this->isPublic) {
|
||||
// remove mount information
|
||||
|
@ -322,13 +322,13 @@ class FilesPlugin extends ServerPlugin {
|
|||
return $perms;
|
||||
});
|
||||
|
||||
$propFind->handle(self::SHARE_PERMISSIONS_PROPERTYNAME, function() use ($node, $httpRequest) {
|
||||
$propFind->handle(self::SHARE_PERMISSIONS_PROPERTYNAME, function () use ($node, $httpRequest) {
|
||||
return $node->getSharePermissions(
|
||||
$httpRequest->getRawServerValue('PHP_AUTH_USER')
|
||||
);
|
||||
});
|
||||
|
||||
$propFind->handle(self::OCM_SHARE_PERMISSIONS_PROPERTYNAME, function() use ($node, $httpRequest) {
|
||||
$propFind->handle(self::OCM_SHARE_PERMISSIONS_PROPERTYNAME, function () use ($node, $httpRequest) {
|
||||
$ncPermissions = $node->getSharePermissions(
|
||||
$httpRequest->getRawServerValue('PHP_AUTH_USER')
|
||||
);
|
||||
|
@ -336,11 +336,11 @@ class FilesPlugin extends ServerPlugin {
|
|||
return json_encode($ocmPermissions);
|
||||
});
|
||||
|
||||
$propFind->handle(self::GETETAG_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::GETETAG_PROPERTYNAME, function () use ($node) {
|
||||
return $node->getETag();
|
||||
});
|
||||
|
||||
$propFind->handle(self::OWNER_ID_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::OWNER_ID_PROPERTYNAME, function () use ($node) {
|
||||
$owner = $node->getOwner();
|
||||
if (!$owner) {
|
||||
return null;
|
||||
|
@ -348,7 +348,7 @@ class FilesPlugin extends ServerPlugin {
|
|||
return $owner->getUID();
|
||||
}
|
||||
});
|
||||
$propFind->handle(self::OWNER_DISPLAY_NAME_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::OWNER_DISPLAY_NAME_PROPERTYNAME, function () use ($node) {
|
||||
$owner = $node->getOwner();
|
||||
if (!$owner) {
|
||||
return null;
|
||||
|
@ -360,14 +360,14 @@ class FilesPlugin extends ServerPlugin {
|
|||
$propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function () use ($node) {
|
||||
return json_encode($this->previewManager->isAvailable($node->getFileInfo()));
|
||||
});
|
||||
$propFind->handle(self::SIZE_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::SIZE_PROPERTYNAME, function () use ($node) {
|
||||
return $node->getSize();
|
||||
});
|
||||
$propFind->handle(self::MOUNT_TYPE_PROPERTYNAME, function () use ($node) {
|
||||
return $node->getFileInfo()->getMountPoint()->getMountType();
|
||||
});
|
||||
|
||||
$propFind->handle(self::SHARE_NOTE, function() use ($node, $httpRequest) {
|
||||
$propFind->handle(self::SHARE_NOTE, function () use ($node, $httpRequest) {
|
||||
return $node->getNoteFromShare(
|
||||
$httpRequest->getRawServerValue('PHP_AUTH_USER')
|
||||
);
|
||||
|
@ -375,13 +375,13 @@ class FilesPlugin extends ServerPlugin {
|
|||
}
|
||||
|
||||
if ($node instanceof \OCA\DAV\Connector\Sabre\Node) {
|
||||
$propFind->handle(self::DATA_FINGERPRINT_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::DATA_FINGERPRINT_PROPERTYNAME, function () use ($node) {
|
||||
return $this->config->getSystemValue('data-fingerprint', '');
|
||||
});
|
||||
}
|
||||
|
||||
if ($node instanceof \OCA\DAV\Connector\Sabre\File) {
|
||||
$propFind->handle(self::DOWNLOADURL_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::DOWNLOADURL_PROPERTYNAME, function () use ($node) {
|
||||
/** @var $node \OCA\DAV\Connector\Sabre\File */
|
||||
try {
|
||||
$directDownloadUrl = $node->getDirectDownload();
|
||||
|
@ -396,7 +396,7 @@ class FilesPlugin extends ServerPlugin {
|
|||
return false;
|
||||
});
|
||||
|
||||
$propFind->handle(self::CHECKSUMS_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::CHECKSUMS_PROPERTYNAME, function () use ($node) {
|
||||
$checksum = $node->getChecksum();
|
||||
if ($checksum === null || $checksum === '') {
|
||||
return null;
|
||||
|
@ -405,22 +405,22 @@ class FilesPlugin extends ServerPlugin {
|
|||
return new ChecksumList($checksum);
|
||||
});
|
||||
|
||||
$propFind->handle(self::CREATION_TIME_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::CREATION_TIME_PROPERTYNAME, function () use ($node) {
|
||||
return $node->getFileInfo()->getCreationTime();
|
||||
});
|
||||
|
||||
$propFind->handle(self::UPLOAD_TIME_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::UPLOAD_TIME_PROPERTYNAME, function () use ($node) {
|
||||
return $node->getFileInfo()->getUploadTime();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if ($node instanceof \OCA\DAV\Connector\Sabre\Directory) {
|
||||
$propFind->handle(self::SIZE_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::SIZE_PROPERTYNAME, function () use ($node) {
|
||||
return $node->getSize();
|
||||
});
|
||||
|
||||
$propFind->handle(self::IS_ENCRYPTED_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::IS_ENCRYPTED_PROPERTYNAME, function () use ($node) {
|
||||
return $node->getFileInfo()->isEncrypted() ? '1' : '0';
|
||||
});
|
||||
}
|
||||
|
@ -467,14 +467,14 @@ class FilesPlugin extends ServerPlugin {
|
|||
return;
|
||||
}
|
||||
|
||||
$propPatch->handle(self::LASTMODIFIED_PROPERTYNAME, function($time) use ($node) {
|
||||
$propPatch->handle(self::LASTMODIFIED_PROPERTYNAME, function ($time) use ($node) {
|
||||
if (empty($time)) {
|
||||
return false;
|
||||
}
|
||||
$node->touch($time);
|
||||
return true;
|
||||
});
|
||||
$propPatch->handle(self::GETETAG_PROPERTYNAME, function($etag) use ($node) {
|
||||
$propPatch->handle(self::GETETAG_PROPERTYNAME, function ($etag) use ($node) {
|
||||
if (empty($etag)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ class FilesPlugin extends ServerPlugin {
|
|||
}
|
||||
return false;
|
||||
});
|
||||
$propPatch->handle(self::CREATION_TIME_PROPERTYNAME, function($time) use ($node) {
|
||||
$propPatch->handle(self::CREATION_TIME_PROPERTYNAME, function ($time) use ($node) {
|
||||
if (empty($time)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ class Principal implements BackendInterface {
|
|||
$users = $this->userManager->getByEmail($value);
|
||||
|
||||
if (!$allowEnumeration) {
|
||||
$users = \array_filter($users, static function(IUser $user) use ($value) {
|
||||
$users = \array_filter($users, static function (IUser $user) use ($value) {
|
||||
return $user->getEMailAddress() === $value;
|
||||
});
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ class Principal implements BackendInterface {
|
|||
});
|
||||
}
|
||||
|
||||
$results[] = array_reduce($users, function(array $carry, IUser $user) use ($restrictGroups) {
|
||||
$results[] = array_reduce($users, function (array $carry, IUser $user) use ($restrictGroups) {
|
||||
// is sharing restricted to groups only?
|
||||
if ($restrictGroups !== false) {
|
||||
$userGroups = $this->groupManager->getUserGroupIds($user);
|
||||
|
@ -305,7 +305,7 @@ class Principal implements BackendInterface {
|
|||
$users = $this->userManager->searchDisplayName($value);
|
||||
|
||||
if (!$allowEnumeration) {
|
||||
$users = \array_filter($users, static function(IUser $user) use ($value) {
|
||||
$users = \array_filter($users, static function (IUser $user) use ($value) {
|
||||
return $user->getDisplayName() === $value;
|
||||
});
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ class Principal implements BackendInterface {
|
|||
});
|
||||
}
|
||||
|
||||
$results[] = array_reduce($users, function(array $carry, IUser $user) use ($restrictGroups) {
|
||||
$results[] = array_reduce($users, function (array $carry, IUser $user) use ($restrictGroups) {
|
||||
// is sharing restricted to groups only?
|
||||
if ($restrictGroups !== false) {
|
||||
$userGroups = $this->groupManager->getUserGroupIds($user);
|
||||
|
@ -518,7 +518,7 @@ class Principal implements BackendInterface {
|
|||
|
||||
$circles = \OCA\Circles\Api\v1\Circles::joinedCircles($name, true);
|
||||
|
||||
$circles = array_map(function($circle) {
|
||||
$circles = array_map(function ($circle) {
|
||||
/** @var \OCA\Circles\Model\Circle $circle */
|
||||
return 'principals/circles/' . urlencode($circle->getUniqueId());
|
||||
}, $circles);
|
||||
|
|
|
@ -200,14 +200,14 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin {
|
|||
$propFind->handle(self::SHARETYPES_PROPERTYNAME, function () use ($sabreNode) {
|
||||
$shares = $this->getShares($sabreNode);
|
||||
|
||||
$shareTypes = array_unique(array_map(function(IShare $share) {
|
||||
$shareTypes = array_unique(array_map(function (IShare $share) {
|
||||
return $share->getShareType();
|
||||
}, $shares));
|
||||
|
||||
return new ShareTypeList($shareTypes);
|
||||
});
|
||||
|
||||
$propFind->handle(self::SHAREES_PROPERTYNAME, function() use ($sabreNode) {
|
||||
$propFind->handle(self::SHAREES_PROPERTYNAME, function () use ($sabreNode) {
|
||||
$shares = $this->getShares($sabreNode);
|
||||
|
||||
return new ShareeList($shares);
|
||||
|
|
|
@ -246,12 +246,12 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin
|
|||
|
||||
$isFav = null;
|
||||
|
||||
$propFind->handle(self::TAGS_PROPERTYNAME, function() use (&$isFav, $node) {
|
||||
$propFind->handle(self::TAGS_PROPERTYNAME, function () use (&$isFav, $node) {
|
||||
list($tags, $isFav) = $this->getTagsAndFav($node->getId());
|
||||
return new TagList($tags);
|
||||
});
|
||||
|
||||
$propFind->handle(self::FAVORITE_PROPERTYNAME, function() use ($isFav, $node) {
|
||||
$propFind->handle(self::FAVORITE_PROPERTYNAME, function () use ($isFav, $node) {
|
||||
if (is_null($isFav)) {
|
||||
list(, $isFav) = $this->getTagsAndFav($node->getId());
|
||||
}
|
||||
|
@ -277,12 +277,12 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin
|
|||
return;
|
||||
}
|
||||
|
||||
$propPatch->handle(self::TAGS_PROPERTYNAME, function($tagList) use ($node) {
|
||||
$propPatch->handle(self::TAGS_PROPERTYNAME, function ($tagList) use ($node) {
|
||||
$this->updateTags($node->getId(), $tagList->getTags());
|
||||
return true;
|
||||
});
|
||||
|
||||
$propPatch->handle(self::FAVORITE_PROPERTYNAME, function($favState) use ($node) {
|
||||
$propPatch->handle(self::FAVORITE_PROPERTYNAME, function ($favState) use ($node) {
|
||||
if ((int)$favState === 1 || $favState === 'true') {
|
||||
$this->getTagger()->tagAs($node->getId(), self::TAG_FAVORITE);
|
||||
} else {
|
||||
|
|
|
@ -78,7 +78,7 @@ class BirthdayCalendarController extends Controller {
|
|||
IDBConnection $db, IConfig $config,
|
||||
IJobList $jobList,
|
||||
IUserManager $userManager,
|
||||
CalDavBackend $calDavBackend){
|
||||
CalDavBackend $calDavBackend) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->db = $db;
|
||||
$this->config = $config;
|
||||
|
@ -94,7 +94,7 @@ class BirthdayCalendarController extends Controller {
|
|||
$this->config->setAppValue($this->appName, 'generateBirthdayCalendar', 'yes');
|
||||
|
||||
// add background job for each user
|
||||
$this->userManager->callForSeenUsers(function(IUser $user) {
|
||||
$this->userManager->callForSeenUsers(function (IUser $user) {
|
||||
$this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [
|
||||
'userId' => $user->getUID(),
|
||||
]);
|
||||
|
|
|
@ -134,7 +134,7 @@ class GroupPrincipalBackend implements BackendInterface {
|
|||
return [];
|
||||
}
|
||||
|
||||
return array_map(function($user) {
|
||||
return array_map(function ($user) {
|
||||
return $this->userToPrincipal($user);
|
||||
}, $group->getUsers());
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ class GroupPrincipalBackend implements BackendInterface {
|
|||
case '{DAV:}displayname':
|
||||
$groups = $this->groupManager->search($value);
|
||||
|
||||
$results[] = array_reduce($groups, function(array $carry, IGroup $group) use ($restrictGroups) {
|
||||
$results[] = array_reduce($groups, function (array $carry, IGroup $group) use ($restrictGroups) {
|
||||
$gid = $group->getGID();
|
||||
// is sharing restricted to groups only?
|
||||
if ($restrictGroups !== false) {
|
||||
|
|
|
@ -192,7 +192,7 @@ class Plugin extends ServerPlugin {
|
|||
function propFind(PropFind $propFind, INode $node) {
|
||||
if ($node instanceof IShareable) {
|
||||
|
||||
$propFind->handle('{' . Plugin::NS_OWNCLOUD . '}invite', function() use ($node) {
|
||||
$propFind->handle('{' . Plugin::NS_OWNCLOUD . '}invite', function () use ($node) {
|
||||
return new Invite(
|
||||
$node->getShares()
|
||||
);
|
||||
|
|
|
@ -66,7 +66,7 @@ class FilesDropPlugin extends ServerPlugin {
|
|||
$this->enabled = false;
|
||||
}
|
||||
|
||||
public function beforeMethod(RequestInterface $request, ResponseInterface $response){
|
||||
public function beforeMethod(RequestInterface $request, ResponseInterface $response) {
|
||||
|
||||
if (!$this->enabled) {
|
||||
return;
|
||||
|
|
|
@ -56,7 +56,7 @@ class PublicLinkCheckPlugin extends ServerPlugin {
|
|||
$server->on('beforeMethod:*', [$this, 'beforeMethod']);
|
||||
}
|
||||
|
||||
public function beforeMethod(RequestInterface $request, ResponseInterface $response){
|
||||
public function beforeMethod(RequestInterface $request, ResponseInterface $response) {
|
||||
// verify that the owner didn't have his share permissions revoked
|
||||
if ($this->fileInfo && !$this->fileInfo->isShareable()) {
|
||||
throw new NotFound();
|
||||
|
|
|
@ -156,7 +156,7 @@ class AppleProvisioningPlugin extends ServerPlugin {
|
|||
$filename = $userId . '-' . AppleProvisioningNode::FILENAME;
|
||||
|
||||
$xmlSkeleton = $this->getTemplate();
|
||||
$body = vsprintf($xmlSkeleton, array_map(function($v) {
|
||||
$body = vsprintf($xmlSkeleton, array_map(function ($v) {
|
||||
return \htmlspecialchars($v, ENT_XML1, 'UTF-8');
|
||||
}, [
|
||||
$description,
|
||||
|
|
|
@ -295,7 +295,7 @@ class Server {
|
|||
\OC::$server->getThemingDefaults(),
|
||||
\OC::$server->getRequest(),
|
||||
\OC::$server->getL10N('dav'),
|
||||
function() {
|
||||
function () {
|
||||
return UUIDUtil::getUUID();
|
||||
}
|
||||
));
|
||||
|
|
|
@ -226,29 +226,29 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin {
|
|||
return;
|
||||
}
|
||||
|
||||
$propFind->handle(self::ID_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::ID_PROPERTYNAME, function () use ($node) {
|
||||
return $node->getSystemTag()->getId();
|
||||
});
|
||||
|
||||
$propFind->handle(self::DISPLAYNAME_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::DISPLAYNAME_PROPERTYNAME, function () use ($node) {
|
||||
return $node->getSystemTag()->getName();
|
||||
});
|
||||
|
||||
$propFind->handle(self::USERVISIBLE_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::USERVISIBLE_PROPERTYNAME, function () use ($node) {
|
||||
return $node->getSystemTag()->isUserVisible() ? 'true' : 'false';
|
||||
});
|
||||
|
||||
$propFind->handle(self::USERASSIGNABLE_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::USERASSIGNABLE_PROPERTYNAME, function () use ($node) {
|
||||
// this is the tag's inherent property "is user assignable"
|
||||
return $node->getSystemTag()->isUserAssignable() ? 'true' : 'false';
|
||||
});
|
||||
|
||||
$propFind->handle(self::CANASSIGN_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::CANASSIGN_PROPERTYNAME, function () use ($node) {
|
||||
// this is the effective permission for the current user
|
||||
return $this->tagManager->canUserAssignTag($node->getSystemTag(), $this->userSession->getUser()) ? 'true' : 'false';
|
||||
});
|
||||
|
||||
$propFind->handle(self::GROUPS_PROPERTYNAME, function() use ($node) {
|
||||
$propFind->handle(self::GROUPS_PROPERTYNAME, function () use ($node) {
|
||||
if (!$this->groupManager->isAdmin($this->userSession->getUser()->getUID())) {
|
||||
// property only available for admins
|
||||
throw new Forbidden();
|
||||
|
@ -281,7 +281,7 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin {
|
|||
self::USERVISIBLE_PROPERTYNAME,
|
||||
self::USERASSIGNABLE_PROPERTYNAME,
|
||||
self::GROUPS_PROPERTYNAME,
|
||||
], function($props) use ($node) {
|
||||
], function ($props) use ($node) {
|
||||
$tag = $node->getSystemTag();
|
||||
$name = $tag->getName();
|
||||
$userVisible = $tag->isUserVisible();
|
||||
|
|
|
@ -122,7 +122,7 @@ class SystemTagsByIdCollection implements ICollection {
|
|||
}
|
||||
|
||||
$tags = $this->tagManager->getAllTags($visibilityFilter);
|
||||
return array_map(function($tag) {
|
||||
return array_map(function ($tag) {
|
||||
return $this->makeNode($tag);
|
||||
}, $tags);
|
||||
}
|
||||
|
|
|
@ -138,11 +138,11 @@ class SystemTagsObjectMappingCollection implements ICollection {
|
|||
$tags = $this->tagManager->getTagsByIds($tagIds);
|
||||
|
||||
// filter out non-visible tags
|
||||
$tags = array_filter($tags, function($tag) {
|
||||
$tags = array_filter($tags, function ($tag) {
|
||||
return $this->tagManager->canUserSeeTag($tag, $this->user);
|
||||
});
|
||||
|
||||
return array_values(array_map(function($tag) {
|
||||
return array_values(array_map(function ($tag) {
|
||||
return $this->makeNode($tag);
|
||||
}, $tags));
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ class SystemTagsRelationsCollection extends SimpleCollection {
|
|||
$tagMapper,
|
||||
$userSession,
|
||||
$groupManager,
|
||||
function($name) {
|
||||
function ($name) {
|
||||
$nodes = \OC::$server->getUserFolder()->getById((int)$name);
|
||||
return !empty($nodes);
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ trait PrincipalProxyTrait {
|
|||
$proxy->setPermissions($proxy->getPermissions() | $permission);
|
||||
$this->proxyMapper->update($proxy);
|
||||
|
||||
$proxies = array_filter($proxies, function(Proxy $p) use ($proxy) {
|
||||
$proxies = array_filter($proxies, function (Proxy $p) use ($proxy) {
|
||||
return $p->getId() !== $proxy->getId();
|
||||
});
|
||||
break;
|
||||
|
|
|
@ -86,7 +86,7 @@ class FutureFile implements \Sabre\DAV\IFile {
|
|||
*/
|
||||
function getSize() {
|
||||
$children = $this->root->getChildren();
|
||||
$sizes = array_map(function($node) {
|
||||
$sizes = array_map(function ($node) {
|
||||
/** @var IFile $node */
|
||||
return $node->getSize();
|
||||
}, $children);
|
||||
|
|
|
@ -59,7 +59,7 @@ class UploadHome implements ICollection {
|
|||
}
|
||||
|
||||
public function getChildren(): array {
|
||||
return array_map(function($node) {
|
||||
return array_map(function ($node) {
|
||||
return new UploadFolder($node, $this->cleanupService);
|
||||
}, $this->impl()->getChildren());
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class RegisterRegenerateBirthdayCalendarsTest extends TestCase {
|
|||
public function testRun() {
|
||||
$this->userManager->expects($this->once())
|
||||
->method('callForSeenUsers')
|
||||
->willReturnCallback(function($closure) {
|
||||
->willReturnCallback(function ($closure) {
|
||||
$user1 = $this->createMock(IUser::class);
|
||||
$user1->method('getUID')->willReturn('uid1');
|
||||
$user2 = $this->createMock(IUser::class);
|
||||
|
|
|
@ -146,7 +146,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
|
|||
$res6->method('getBackend')->willReturn($backend3);
|
||||
|
||||
$res6->method('getAllAvailableMetadataKeys')->willReturn(['meta99', 'meta123']);
|
||||
$res6->method('getMetadataForKey')->willReturnCallback(function($key) {
|
||||
$res6->method('getMetadataForKey')->willReturnCallback(function ($key) {
|
||||
switch($key) {
|
||||
case 'meta99':
|
||||
return 'value99-new';
|
||||
|
@ -165,7 +165,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
|
|||
$res7->method('getEMail')->willReturn('res7@foo.bar');
|
||||
$res7->method('getBackend')->willReturn($backend3);
|
||||
$res7->method('getAllAvailableMetadataKeys')->willReturn(['meta1']);
|
||||
$res7->method('getMetadataForKey')->willReturnCallback(function($key) {
|
||||
$res7->method('getMetadataForKey')->willReturnCallback(function ($key) {
|
||||
switch($key) {
|
||||
case 'meta1':
|
||||
return 'value1';
|
||||
|
@ -181,7 +181,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
|
|||
$res8->method('getEMail')->willReturn('res8@foo.bar');
|
||||
$res8->method('getBackend')->willReturn($backend4);
|
||||
$res8->method('getAllAvailableMetadataKeys')->willReturn(['meta2']);
|
||||
$res8->method('getMetadataForKey')->willReturnCallback(function($key) {
|
||||
$res8->method('getMetadataForKey')->willReturnCallback(function ($key) {
|
||||
switch($key) {
|
||||
case 'meta2':
|
||||
return 'value2';
|
||||
|
|
|
@ -97,7 +97,7 @@ class BackendTest extends TestCase {
|
|||
$backend = $this->getBackend(['triggerCalendarActivity']);
|
||||
$backend->expects($this->once())
|
||||
->method('triggerCalendarActivity')
|
||||
->willReturnCallback(function() use($expectedPayload, $expectedSubject) {
|
||||
->willReturnCallback(function () use ($expectedPayload, $expectedSubject) {
|
||||
$arguments = func_get_args();
|
||||
$this->assertSame($expectedSubject, array_shift($arguments));
|
||||
$this->assertEquals($expectedPayload, $arguments);
|
||||
|
|
|
@ -45,7 +45,7 @@ class CalendarTest extends TestCase {
|
|||
$l = $this->createMock(IL10N::class);
|
||||
$l->expects($this->any())
|
||||
->method('t')
|
||||
->willReturnCallback(function($string, $args) {
|
||||
->willReturnCallback(function ($string, $args) {
|
||||
return vsprintf($string, $args);
|
||||
});
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class TodoTest extends TestCase {
|
|||
$l = $this->createMock(IL10N::class);
|
||||
$l->expects($this->any())
|
||||
->method('t')
|
||||
->willReturnCallback(function($string, $args) {
|
||||
->willReturnCallback(function ($string, $args) {
|
||||
return vsprintf($string, $args);
|
||||
});
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ class BaseTest extends TestCase {
|
|||
$l = $this->createMock(IL10N::class);
|
||||
$l->expects($this->any())
|
||||
->method('t')
|
||||
->willReturnCallback(function($string, $args) {
|
||||
->willReturnCallback(function ($string, $args) {
|
||||
return 't(' . vsprintf($string, $args) . ')';
|
||||
});
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ class EnablePluginTest extends TestCase {
|
|||
|
||||
$this->server->xml->expects($this->once())
|
||||
->method('parse')
|
||||
->willReturnCallback(function($requestBody, $url, &$documentType) {
|
||||
->willReturnCallback(function ($requestBody, $url, &$documentType) {
|
||||
$documentType = '{http://nextcloud.com/ns}disable-birthday-calendar';
|
||||
});
|
||||
|
||||
|
@ -167,7 +167,7 @@ class EnablePluginTest extends TestCase {
|
|||
|
||||
$this->server->xml->expects($this->once())
|
||||
->method('parse')
|
||||
->willReturnCallback(function($requestBody, $url, &$documentType) {
|
||||
->willReturnCallback(function ($requestBody, $url, &$documentType) {
|
||||
$documentType = '{http://nextcloud.com/ns}enable-birthday-calendar';
|
||||
});
|
||||
|
||||
|
|
|
@ -401,7 +401,7 @@ EOD;
|
|||
$this->assertArrayHasKey('classification', $card);
|
||||
}
|
||||
|
||||
usort($calendarObjects, function($a, $b) {
|
||||
usort($calendarObjects, function ($a, $b) {
|
||||
return $a['id'] - $b['id'];
|
||||
});
|
||||
|
||||
|
@ -442,7 +442,7 @@ EOD;
|
|||
'comp-filters' => $compFilter
|
||||
]);
|
||||
|
||||
$expectedEventsInResult = array_map(function($index) use($events) {
|
||||
$expectedEventsInResult = array_map(function ($index) use ($events) {
|
||||
return $events[$index];
|
||||
}, $expectedEventsInResult);
|
||||
$this->assertEquals($expectedEventsInResult, $result, '', 0.0, 10, true);
|
||||
|
|
|
@ -70,7 +70,7 @@ class CalendarManagerTest extends \Test\TestCase {
|
|||
$calendarManager = $this->createMock(Manager::class);
|
||||
$calendarManager->expects($this->at(0))
|
||||
->method('registerCalendar')
|
||||
->willReturnCallback(function() {
|
||||
->willReturnCallback(function () {
|
||||
$parameter = func_get_arg(0);
|
||||
$this->assertInstanceOf(CalendarImpl::class, $parameter);
|
||||
$this->assertEquals(123, $parameter->getKey());
|
||||
|
@ -78,7 +78,7 @@ class CalendarManagerTest extends \Test\TestCase {
|
|||
|
||||
$calendarManager->expects($this->at(1))
|
||||
->method('registerCalendar')
|
||||
->willReturnCallback(function() {
|
||||
->willReturnCallback(function () {
|
||||
$parameter = func_get_arg(0);
|
||||
$this->assertInstanceOf(CalendarImpl::class, $parameter);
|
||||
$this->assertEquals(456, $parameter->getKey());
|
||||
|
|
|
@ -569,7 +569,7 @@ EOD;
|
|||
|
||||
$backend->expects($this->any())
|
||||
->method('getCalendarObject')
|
||||
->willReturnCallback(function($cId, $uri) use($publicObject, $confidentialObject) {
|
||||
->willReturnCallback(function ($cId, $uri) use ($publicObject, $confidentialObject) {
|
||||
switch($uri) {
|
||||
case 'event-0':
|
||||
return $publicObject;
|
||||
|
|
|
@ -56,7 +56,7 @@ class NotificationProviderManagerTest extends TestCase {
|
|||
* @throws ProviderNotAvailableException
|
||||
* @throws NotificationTypeDoesNotExistException
|
||||
*/
|
||||
public function testGetProviderForUnknownType(): void{
|
||||
public function testGetProviderForUnknownType(): void {
|
||||
$this->expectException(\OCA\DAV\CalDAV\Reminder\NotificationTypeDoesNotExistException::class);
|
||||
$this->expectExceptionMessage('Type NOT EXISTENT is not an accepted type of notification');
|
||||
|
||||
|
@ -67,19 +67,19 @@ class NotificationProviderManagerTest extends TestCase {
|
|||
* @throws NotificationTypeDoesNotExistException
|
||||
* @throws ProviderNotAvailableException
|
||||
*/
|
||||
public function testGetProviderForUnRegisteredType(): void{
|
||||
public function testGetProviderForUnRegisteredType(): void {
|
||||
$this->expectException(\OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException::class);
|
||||
$this->expectExceptionMessage('No notification provider for type AUDIO available');
|
||||
|
||||
$this->providerManager->getProvider('AUDIO');
|
||||
}
|
||||
|
||||
public function testGetProvider(): void{
|
||||
public function testGetProvider(): void {
|
||||
$provider = $this->providerManager->getProvider('EMAIL');
|
||||
$this->assertInstanceOf(EmailProvider::class, $provider);
|
||||
}
|
||||
|
||||
public function testRegisterProvider(): void{
|
||||
public function testRegisterProvider(): void {
|
||||
$this->providerManager->registerProvider(PushProvider::class);
|
||||
$provider = $this->providerManager->getProvider('DISPLAY');
|
||||
$this->assertInstanceOf(PushProvider::class, $provider);
|
||||
|
@ -88,7 +88,7 @@ class NotificationProviderManagerTest extends TestCase {
|
|||
/**
|
||||
* @throws \OCP\AppFramework\QueryException
|
||||
*/
|
||||
public function testRegisterBadProvider(): void{
|
||||
public function testRegisterBadProvider(): void {
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Invalid notification provider registered');
|
||||
|
||||
|
|
|
@ -61,18 +61,18 @@ class NotifierTest extends TestCase {
|
|||
$this->l10n = $this->createMock(IL10N::class);
|
||||
$this->l10n->expects($this->any())
|
||||
->method('t')
|
||||
->willReturnCallback(function($string, $args) {
|
||||
->willReturnCallback(function ($string, $args) {
|
||||
return vsprintf($string, $args);
|
||||
});
|
||||
$this->l10n->expects($this->any())
|
||||
->method('l')
|
||||
->willReturnCallback(function($string, $args) {
|
||||
->willReturnCallback(function ($string, $args) {
|
||||
/** \DateTime $args */
|
||||
return $args->format(\DateTime::ATOM);
|
||||
});
|
||||
$this->l10n->expects($this->any())
|
||||
->method('n')
|
||||
->willReturnCallback(function($textSingular, $textPlural, $count, $args) {
|
||||
->willReturnCallback(function ($textSingular, $textPlural, $count, $args) {
|
||||
$text = $count === 1 ? $textSingular : $textPlural;
|
||||
$text = str_replace('%n', (string)$count, $text);
|
||||
return vsprintf($text, $args);
|
||||
|
|
|
@ -501,7 +501,7 @@ EOD;
|
|||
|
||||
$provider1->expects($this->once())
|
||||
->method('send')
|
||||
->with($this->callback(function($vevent) {
|
||||
->with($this->callback(function ($vevent) {
|
||||
if ($vevent->DTSTART->getDateTime()->format(\DateTime::ATOM) !== '2016-06-09T00:00:00+00:00') {
|
||||
return false;
|
||||
}
|
||||
|
@ -509,7 +509,7 @@ EOD;
|
|||
}, 'Displayname 123', $user));
|
||||
$provider2->expects($this->once())
|
||||
->method('send')
|
||||
->with($this->callback(function($vevent) {
|
||||
->with($this->callback(function ($vevent) {
|
||||
if ($vevent->DTSTART->getDateTime()->format(\DateTime::ATOM) !== '2016-06-09T00:00:00+00:00') {
|
||||
return false;
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ EOD;
|
|||
}, 'Displayname 123', $user));
|
||||
$provider3->expects($this->once())
|
||||
->method('send')
|
||||
->with($this->callback(function($vevent) {
|
||||
->with($this->callback(function ($vevent) {
|
||||
if ($vevent->DTSTART->getDateTime()->format(\DateTime::ATOM) !== '2016-06-09T00:00:00+00:00') {
|
||||
return false;
|
||||
}
|
||||
|
@ -525,7 +525,7 @@ EOD;
|
|||
}, 'Displayname 123', $user));
|
||||
$provider4->expects($this->once())
|
||||
->method('send')
|
||||
->with($this->callback(function($vevent) {
|
||||
->with($this->callback(function ($vevent) {
|
||||
if ($vevent->DTSTART->getDateTime()->format(\DateTime::ATOM) !== '2016-06-30T00:00:00+00:00') {
|
||||
return false;
|
||||
}
|
||||
|
@ -533,7 +533,7 @@ EOD;
|
|||
}, 'Displayname 123', $user));
|
||||
$provider5->expects($this->once())
|
||||
->method('send')
|
||||
->with($this->callback(function($vevent) {
|
||||
->with($this->callback(function ($vevent) {
|
||||
if ($vevent->DTSTART->getDateTime()->format(\DateTime::ATOM) !== '2016-07-07T00:00:00+00:00') {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -236,7 +236,7 @@ abstract class AbstractPrincipalBackendTest extends TestCase {
|
|||
|
||||
$this->proxyMapper->expects($this->at(1))
|
||||
->method('insert')
|
||||
->with($this->callback(function($proxy) {
|
||||
->with($this->callback(function ($proxy) {
|
||||
/** @var Proxy $proxy */
|
||||
if ($proxy->getOwnerId() !== $this->principalPrefix . '/backend1-res1') {
|
||||
return false;
|
||||
|
@ -252,7 +252,7 @@ abstract class AbstractPrincipalBackendTest extends TestCase {
|
|||
}));
|
||||
$this->proxyMapper->expects($this->at(2))
|
||||
->method('insert')
|
||||
->with($this->callback(function($proxy) {
|
||||
->with($this->callback(function ($proxy) {
|
||||
/** @var Proxy $proxy */
|
||||
if ($proxy->getOwnerId() !== $this->principalPrefix . '/backend1-res1') {
|
||||
return false;
|
||||
|
|
|
@ -107,7 +107,7 @@ class IMipPluginTest extends TestCase {
|
|||
|
||||
$l10n = $this->createMock(IL10N::class);
|
||||
$l10n->method('t')
|
||||
->willReturnCallback(function($text, $parameters = []) {
|
||||
->willReturnCallback(function ($text, $parameters = []) {
|
||||
return vsprintf($text, $parameters);
|
||||
});
|
||||
$l10nFactory = $this->createMock(IFactory::class);
|
||||
|
@ -223,7 +223,7 @@ class IMipPluginTest extends TestCase {
|
|||
/**
|
||||
* @dataProvider dataIncludeResponseButtons
|
||||
*/
|
||||
public function testIncludeResponseButtons(string $config_setting, string $recipient, bool $has_buttons ) {
|
||||
public function testIncludeResponseButtons(string $config_setting, string $recipient, bool $has_buttons) {
|
||||
$message = $this->_testMessage([],$recipient);
|
||||
|
||||
$this->_expectSend($recipient, true, $has_buttons);
|
||||
|
@ -264,7 +264,7 @@ class IMipPluginTest extends TestCase {
|
|||
$this->assertEquals('1.1', $message->getScheduleStatus());
|
||||
}
|
||||
|
||||
private function _testMessage(array $attrs = [], string $recipient = 'frodo@hobb.it' ) {
|
||||
private function _testMessage(array $attrs = [], string $recipient = 'frodo@hobb.it') {
|
||||
$message = new Message();
|
||||
$message->method = 'REQUEST';
|
||||
$message->message = new VCalendar();
|
||||
|
|
|
@ -116,7 +116,7 @@ class RefreshWebcalServiceTest extends TestCase {
|
|||
|
||||
$client->expects($this->once())
|
||||
->method('get')
|
||||
->with('https://foo.bar/bla2', $this->callback(function($obj) {
|
||||
->with('https://foo.bar/bla2', $this->callback(function ($obj) {
|
||||
return $obj['allow_redirects']['redirects'] === 10 && $obj['handler'] instanceof HandlerStack;
|
||||
}))
|
||||
->willReturn($response);
|
||||
|
|
|
@ -280,7 +280,7 @@ class AddressBookImplTest extends TestCase {
|
|||
// simulate that 'uid0' already exists, so the second uid will be returned
|
||||
$this->backend->expects($this->exactly(2))->method('getContact')
|
||||
->willReturnCallback(
|
||||
function($id, $uid) {
|
||||
function ($id, $uid) {
|
||||
return ($uid === 'uid0.vcf');
|
||||
}
|
||||
);
|
||||
|
|
|
@ -66,7 +66,7 @@ class BirthdayServiceTest extends TestCase {
|
|||
|
||||
$this->l10n->expects($this->any())
|
||||
->method('t')
|
||||
->willReturnCallback(function($string, $args) {
|
||||
->willReturnCallback(function ($string, $args) {
|
||||
return vsprintf($string, $args);
|
||||
});
|
||||
|
||||
|
@ -392,7 +392,7 @@ class BirthdayServiceTest extends TestCase {
|
|||
];
|
||||
}
|
||||
|
||||
public function providesCardChanges(){
|
||||
public function providesCardChanges() {
|
||||
return[
|
||||
['delete'],
|
||||
['create'],
|
||||
|
|
|
@ -258,7 +258,7 @@ class CardDavBackendTest extends TestCase {
|
|||
// Expect event
|
||||
$this->dispatcher->expects($this->at(0))
|
||||
->method('dispatch')
|
||||
->with('\OCA\DAV\CardDAV\CardDavBackend::createCard', $this->callback(function(GenericEvent $e) use ($bookId, $uri) {
|
||||
->with('\OCA\DAV\CardDAV\CardDavBackend::createCard', $this->callback(function (GenericEvent $e) use ($bookId, $uri) {
|
||||
return $e->getArgument('addressBookId') === $bookId &&
|
||||
$e->getArgument('cardUri') === $uri &&
|
||||
$e->getArgument('cardData') === $this->vcardTest0;
|
||||
|
@ -285,7 +285,7 @@ class CardDavBackendTest extends TestCase {
|
|||
// Expect event
|
||||
$this->dispatcher->expects($this->at(0))
|
||||
->method('dispatch')
|
||||
->with('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $this->callback(function(GenericEvent $e) use ($bookId, $uri) {
|
||||
->with('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $this->callback(function (GenericEvent $e) use ($bookId, $uri) {
|
||||
return $e->getArgument('addressBookId') === $bookId &&
|
||||
$e->getArgument('cardUri') === $uri &&
|
||||
$e->getArgument('cardData') === $this->vcardTest0;
|
||||
|
@ -299,7 +299,7 @@ class CardDavBackendTest extends TestCase {
|
|||
// Expect event
|
||||
$this->dispatcher->expects($this->at(0))
|
||||
->method('dispatch')
|
||||
->with('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', $this->callback(function(GenericEvent $e) use ($bookId, $uri) {
|
||||
->with('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', $this->callback(function (GenericEvent $e) use ($bookId, $uri) {
|
||||
return $e->getArgument('addressBookId') === $bookId &&
|
||||
$e->getArgument('cardUri') === $uri;
|
||||
}));
|
||||
|
|
|
@ -140,7 +140,7 @@ class ImageExportPluginTest extends TestCase {
|
|||
->willReturn(1);
|
||||
|
||||
$this->tree->method('getNodeForPath')
|
||||
->willReturnCallback(function($path) use ($card, $book) {
|
||||
->willReturnCallback(function ($path) use ($card, $book) {
|
||||
if ($path === 'user/book/card') {
|
||||
return $card;
|
||||
} else if ($path === 'user/book') {
|
||||
|
|
|
@ -100,8 +100,8 @@ class RootCollectionTest extends \Test\TestCase {
|
|||
->method('getUser')
|
||||
->willReturn($this->user);
|
||||
|
||||
$this->dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) {
|
||||
$event->addEntityCollection('files', function() {
|
||||
$this->dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function (CommentsEntityEvent $event) {
|
||||
$event->addEntityCollection('files', function () {
|
||||
return true;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -62,7 +62,7 @@ class ExceptionLoggerPluginTest extends TestCase {
|
|||
$config = $this->createMock(SystemConfig::class);
|
||||
$config->expects($this->any())
|
||||
->method('getValue')
|
||||
->willReturnCallback(function($key, $default) {
|
||||
->willReturnCallback(function ($key, $default) {
|
||||
switch ($key) {
|
||||
case 'loglevel':
|
||||
return 0;
|
||||
|
|
|
@ -283,7 +283,7 @@ class ObjectTreeTest extends \Test\TestCase {
|
|||
->getMock();
|
||||
$view->expects($this->once())
|
||||
->method('resolvePath')
|
||||
->willReturnCallback(function($path) use ($storage){
|
||||
->willReturnCallback(function ($path) use ($storage) {
|
||||
return [$storage, ltrim($path, '/')];
|
||||
});
|
||||
|
||||
|
|
|
@ -392,7 +392,7 @@ class PrincipalTest extends TestCase {
|
|||
|
||||
$this->proxyMapper->expects($this->at(1))
|
||||
->method('insert')
|
||||
->with($this->callback(function($proxy) {
|
||||
->with($this->callback(function ($proxy) {
|
||||
/** @var Proxy $proxy */
|
||||
if ($proxy->getOwnerId() !== 'principals/users/foo') {
|
||||
return false;
|
||||
|
|
|
@ -125,7 +125,7 @@ class SharesPluginTest extends \Test\TestCase {
|
|||
$this->equalTo(false),
|
||||
$this->equalTo(-1)
|
||||
)
|
||||
->willReturnCallback(function($userId, $requestedShareType, $node, $flag, $limit) use ($shareTypes){
|
||||
->willReturnCallback(function ($userId, $requestedShareType, $node, $flag, $limit) use ($shareTypes) {
|
||||
if (in_array($requestedShareType, $shareTypes)) {
|
||||
$share = $this->createMock(IShare::class);
|
||||
$share->method('getShareType')
|
||||
|
@ -191,7 +191,7 @@ class SharesPluginTest extends \Test\TestCase {
|
|||
->with('/subdir')
|
||||
->willReturn($node);
|
||||
|
||||
$dummyShares = array_map(function($type) {
|
||||
$dummyShares = array_map(function ($type) {
|
||||
$share = $this->getMockBuilder(IShare::class)->getMock();
|
||||
$share->expects($this->any())
|
||||
->method('getShareType')
|
||||
|
@ -208,7 +208,7 @@ class SharesPluginTest extends \Test\TestCase {
|
|||
$this->equalTo(false),
|
||||
$this->equalTo(-1)
|
||||
)
|
||||
->willReturnCallback(function($userId, $requestedShareType, $node, $flag, $limit) use ($shareTypes, $dummyShares){
|
||||
->willReturnCallback(function ($userId, $requestedShareType, $node, $flag, $limit) use ($shareTypes, $dummyShares) {
|
||||
if ($node->getId() === 111 && in_array($requestedShareType, $shareTypes)) {
|
||||
foreach ($dummyShares as $dummyShare) {
|
||||
if ($dummyShare->getShareType() === $requestedShareType) {
|
||||
|
|
|
@ -82,7 +82,7 @@ class BirthdayCalendarControllerTest extends TestCase {
|
|||
|
||||
$this->userManager->expects($this->once())
|
||||
->method('callForSeenUsers')
|
||||
->willReturnCallback(function($closure) {
|
||||
->willReturnCallback(function ($closure) {
|
||||
$user1 = $this->createMock(IUser::class);
|
||||
$user1->method('getUID')->willReturn('uid1');
|
||||
$user2 = $this->createMock(IUser::class);
|
||||
|
|
|
@ -143,7 +143,7 @@ class DirectControllerTest extends TestCase {
|
|||
});
|
||||
|
||||
$this->urlGenerator->method('getAbsoluteURL')
|
||||
->willReturnCallback(function(string $url) {
|
||||
->willReturnCallback(function (string $url) {
|
||||
return 'https://my.nextcloud/'.$url;
|
||||
});
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ EOF;
|
|||
$called = false;
|
||||
$this->responseServer->expects($this->once())
|
||||
->method('handleITipMessage')
|
||||
->willReturnCallback(function(Message $iTipMessage) use (&$called, $expected) {
|
||||
->willReturnCallback(function (Message $iTipMessage) use (&$called, $expected) {
|
||||
$called = true;
|
||||
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid);
|
||||
$this->assertEquals('VEVENT', $iTipMessage->component);
|
||||
|
@ -164,7 +164,7 @@ EOF;
|
|||
$called = false;
|
||||
$this->responseServer->expects($this->once())
|
||||
->method('handleITipMessage')
|
||||
->willReturnCallback(function(Message $iTipMessage) use (&$called, $expected) {
|
||||
->willReturnCallback(function (Message $iTipMessage) use (&$called, $expected) {
|
||||
$called = true;
|
||||
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid);
|
||||
$this->assertEquals('VEVENT', $iTipMessage->component);
|
||||
|
@ -221,7 +221,7 @@ EOF;
|
|||
$called = false;
|
||||
$this->responseServer->expects($this->once())
|
||||
->method('handleITipMessage')
|
||||
->willReturnCallback(function(Message $iTipMessage) use (&$called, $expected) {
|
||||
->willReturnCallback(function (Message $iTipMessage) use (&$called, $expected) {
|
||||
$called = true;
|
||||
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid);
|
||||
$this->assertEquals('VEVENT', $iTipMessage->component);
|
||||
|
@ -304,7 +304,7 @@ EOF;
|
|||
$called = false;
|
||||
$this->responseServer->expects($this->once())
|
||||
->method('handleITipMessage')
|
||||
->willReturnCallback(function(Message $iTipMessage) use (&$called, $expected) {
|
||||
->willReturnCallback(function (Message $iTipMessage) use (&$called, $expected) {
|
||||
$called = true;
|
||||
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid);
|
||||
$this->assertEquals('VEVENT', $iTipMessage->component);
|
||||
|
@ -382,7 +382,7 @@ EOF;
|
|||
$called = false;
|
||||
$this->responseServer->expects($this->once())
|
||||
->method('handleITipMessage')
|
||||
->willReturnCallback(function(Message $iTipMessage) use (&$called, $expected) {
|
||||
->willReturnCallback(function (Message $iTipMessage) use (&$called, $expected) {
|
||||
$called = true;
|
||||
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid);
|
||||
$this->assertEquals('VEVENT', $iTipMessage->component);
|
||||
|
|
|
@ -37,7 +37,7 @@ class AnonymousOptionsTest extends TestCase {
|
|||
private function sendRequest($method, $path, $userAgent = '') {
|
||||
$server = new Server();
|
||||
$server->addPlugin(new AnonymousOptionsPlugin());
|
||||
$server->addPlugin(new Plugin(new BasicCallBack(function() {
|
||||
$server->addPlugin(new Plugin(new BasicCallBack(function () {
|
||||
return false;
|
||||
})));
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ class FilesDropPluginTest extends TestCase {
|
|||
->willReturn('https://example.com');
|
||||
|
||||
$this->view->method('file_exists')
|
||||
->willReturnCallback(function($path) {
|
||||
->willReturnCallback(function ($path) {
|
||||
if ($path === 'file.txt' || $path === '/file.txt') {
|
||||
return true;
|
||||
} else {
|
||||
|
@ -165,7 +165,7 @@ class FilesDropPluginTest extends TestCase {
|
|||
->willReturn('https://example.com');
|
||||
|
||||
$this->view->method('file_exists')
|
||||
->willReturnCallback(function($path) {
|
||||
->willReturnCallback(function ($path) {
|
||||
if ($path === 'file.txt' || $path === '/file.txt') {
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
@ -78,7 +78,7 @@ class AppleProvisioningPluginTest extends TestCase {
|
|||
$this->themingDefaults,
|
||||
$this->request,
|
||||
$this->l10n,
|
||||
function() {
|
||||
function () {
|
||||
return 'generated-uuid';
|
||||
}
|
||||
);
|
||||
|
@ -92,7 +92,7 @@ class AppleProvisioningPluginTest extends TestCase {
|
|||
|
||||
$plugin = new AppleProvisioningPlugin($this->userSession,
|
||||
$this->urlGenerator, $this->themingDefaults, $this->request, $this->l10n,
|
||||
function() {});
|
||||
function () {});
|
||||
|
||||
$server->expects($this->at(0))
|
||||
->method('on')
|
||||
|
|
|
@ -251,7 +251,7 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
|
|||
|
||||
$this->tagManager->expects($this->exactly(3))
|
||||
->method('canUserSeeTag')
|
||||
->willReturnCallback(function($tag) {
|
||||
->willReturnCallback(function ($tag) {
|
||||
return $tag->isUserVisible();
|
||||
});
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
|
|||
->getMock();
|
||||
$userFolder = $this->userFolder;
|
||||
|
||||
$closure = function($name) use ($userFolder) {
|
||||
$closure = function ($name) use ($userFolder) {
|
||||
$nodes = $userFolder->getById(intval($name));
|
||||
return !empty($nodes);
|
||||
};
|
||||
|
|
|
@ -111,7 +111,7 @@ class Application extends \OCP\AppFramework\App {
|
|||
$this->encryptionManager->registerEncryptionModule(
|
||||
Encryption::ID,
|
||||
Encryption::DISPLAY_NAME,
|
||||
function() use ($container) {
|
||||
function () use ($container) {
|
||||
|
||||
return new Encryption(
|
||||
$container->query('Crypt'),
|
||||
|
|
|
@ -86,7 +86,7 @@ class SettingsControllerTest extends TestCase {
|
|||
|
||||
$this->l10nMock->expects($this->any())
|
||||
->method('t')
|
||||
->willReturnCallback(function($message) {
|
||||
->willReturnCallback(function ($message) {
|
||||
return $message;
|
||||
});
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class StatusControllerTest extends TestCase {
|
|||
->disableOriginalConstructor()->getMock();
|
||||
$this->l10nMock->expects($this->any())
|
||||
->method('t')
|
||||
->willReturnCallback(function($message) {
|
||||
->willReturnCallback(function ($message) {
|
||||
return $message;
|
||||
});
|
||||
$this->encryptionManagerMock = $this->createMock(IManager::class);
|
||||
|
|
|
@ -322,7 +322,7 @@ class EncryptAllTest extends TestCase {
|
|||
|
||||
$this->view->expects($this->any())->method('is_dir')
|
||||
->willReturnCallback(
|
||||
function($path) {
|
||||
function ($path) {
|
||||
if ($path === '/user1/files/foo') {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -323,7 +323,7 @@ class EncryptionTest extends TestCase {
|
|||
|
||||
$this->keyManagerMock->expects($this->any())
|
||||
->method('addSystemKeys')
|
||||
->willReturnCallback(function($accessList, $publicKeys) {
|
||||
->willReturnCallback(function ($accessList, $publicKeys) {
|
||||
return $publicKeys;
|
||||
});
|
||||
|
||||
|
@ -350,7 +350,7 @@ class EncryptionTest extends TestCase {
|
|||
$this->keyManagerMock->expects($this->never())->method('getPublicKey');
|
||||
$this->keyManagerMock->expects($this->never())->method('addSystemKeys');
|
||||
$this->keyManagerMock->expects($this->once())->method('setVersion')
|
||||
->willReturnCallback(function($path, $version, $view) {
|
||||
->willReturnCallback(function ($path, $version, $view) {
|
||||
$this->assertSame('path', $path);
|
||||
$this->assertSame(2, $version);
|
||||
$this->assertTrue($view instanceof \OC\Files\View);
|
||||
|
@ -368,20 +368,20 @@ class EncryptionTest extends TestCase {
|
|||
|
||||
$this->keyManagerMock->expects($this->any())
|
||||
->method('getPublicKey')->willReturnCallback(
|
||||
function($user) {
|
||||
function ($user) {
|
||||
throw new PublicKeyMissingException($user);
|
||||
}
|
||||
);
|
||||
|
||||
$this->keyManagerMock->expects($this->any())
|
||||
->method('addSystemKeys')
|
||||
->willReturnCallback(function($accessList, $publicKeys) {
|
||||
->willReturnCallback(function ($accessList, $publicKeys) {
|
||||
return $publicKeys;
|
||||
});
|
||||
|
||||
$this->cryptMock->expects($this->once())->method('multiKeyEncrypt')
|
||||
->willReturnCallback(
|
||||
function($fileKey, $publicKeys) {
|
||||
function ($fileKey, $publicKeys) {
|
||||
$this->assertEmpty($publicKeys);
|
||||
$this->assertSame('fileKey', $fileKey);
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ class KeyManagerTest extends TestCase {
|
|||
|
||||
$this->keyStorageMock->expects($this->exactly(2))
|
||||
->method('getUserKey')
|
||||
->willReturnCallback(function ($uid, $keyID, $encryptionModuleId){
|
||||
->willReturnCallback(function ($uid, $keyID, $encryptionModuleId) {
|
||||
if ($keyID === 'publicKey') {
|
||||
return '';
|
||||
}
|
||||
|
@ -473,13 +473,13 @@ class KeyManagerTest extends TestCase {
|
|||
|
||||
$this->keyStorageMock->expects($this->any())
|
||||
->method('getSystemUserKey')
|
||||
->willReturnCallback(function($keyId, $encryptionModuleId) {
|
||||
->willReturnCallback(function ($keyId, $encryptionModuleId) {
|
||||
return $keyId;
|
||||
});
|
||||
|
||||
$this->utilMock->expects($this->any())
|
||||
->method('isRecoveryEnabledForUser')
|
||||
->willReturnCallback(function($uid) {
|
||||
->willReturnCallback(function ($uid) {
|
||||
if ($uid === 'user1') {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class Application extends App {
|
|||
$cloudFederationManager = $server->getCloudFederationProviderManager();
|
||||
$cloudFederationManager->addCloudFederationProvider('file',
|
||||
'Federated Files Sharing',
|
||||
function() use ($container) {
|
||||
function () use ($container) {
|
||||
$server = $container->getServer();
|
||||
return new CloudFederationProviderFiles(
|
||||
$server->getAppManager(),
|
||||
|
@ -72,7 +72,7 @@ class Application extends App {
|
|||
);
|
||||
});
|
||||
|
||||
$container->registerService('RequestHandlerController', function(SimpleContainer $c) use ($server) {
|
||||
$container->registerService('RequestHandlerController', function (SimpleContainer $c) use ($server) {
|
||||
$addressHandler = new AddressHandler(
|
||||
$server->getURLGenerator(),
|
||||
$server->getL10N('federatedfilesharing'),
|
||||
|
@ -111,7 +111,7 @@ class Application extends App {
|
|||
|
||||
$eventDispatcher->addListener(
|
||||
'OCA\Files::loadAdditionalScripts',
|
||||
function() use ($federatedShareProvider) {
|
||||
function () use ($federatedShareProvider) {
|
||||
if ($federatedShareProvider->isIncomingServer2serverShareEnabled()) {
|
||||
\OCP\Util::addScript('federatedfilesharing', 'external');
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ class MountPublicLinkControllerTest extends \Test\TestCase {
|
|||
$this->addressHandler->expects($this->any())->method('splitUserRemote')
|
||||
->with($shareWith)
|
||||
->willReturnCallback(
|
||||
function($shareWith) use ($validShareWith, $expectedReturnData) {
|
||||
function ($shareWith) use ($validShareWith, $expectedReturnData) {
|
||||
if ($validShareWith) {
|
||||
return ['user', 'server'];
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
|
|||
->getMock();
|
||||
$this->l = $this->getMockBuilder(IL10N::class)->getMock();
|
||||
$this->l->method('t')
|
||||
->willReturnCallback(function($text, $parameters = []) {
|
||||
->willReturnCallback(function ($text, $parameters = []) {
|
||||
return vsprintf($text, $parameters);
|
||||
});
|
||||
$this->logger = $this->getMockBuilder(ILogger::class)->getMock();
|
||||
|
|
|
@ -69,7 +69,7 @@ class Application extends App {
|
|||
);
|
||||
|
||||
$dispatcher = $container->getServer()->getEventDispatcher();
|
||||
$dispatcher->addListener('OCA\DAV\Connector\Sabre::authInit', function($event) use($container) {
|
||||
$dispatcher->addListener('OCA\DAV\Connector\Sabre::authInit', function ($event) use ($container) {
|
||||
if ($event instanceof SabrePluginEvent) {
|
||||
$server = $event->getServer();
|
||||
if ($server instanceof Server) {
|
||||
|
|
|
@ -60,7 +60,7 @@ class SyncFederationAddressBooks extends Command {
|
|||
|
||||
$progress = new ProgressBar($output);
|
||||
$progress->start();
|
||||
$this->syncService->syncThemAll(function($url, $ex) use ($progress, $output) {
|
||||
$this->syncService->syncThemAll(function ($url, $ex) use ($progress, $output) {
|
||||
if ($ex instanceof \Exception) {
|
||||
$output->writeln("Error while syncing $url : " . $ex->getMessage());
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class SyncJob extends TimedJob {
|
|||
}
|
||||
|
||||
protected function run($argument) {
|
||||
$this->syncService->syncThemAll(function($url, $ex) {
|
||||
$this->syncService->syncThemAll(function ($url, $ex) {
|
||||
if ($ex instanceof \Exception) {
|
||||
$this->logger->logException($ex, [
|
||||
'message' => "Error while syncing $url.",
|
||||
|
|
|
@ -75,7 +75,7 @@ class AddServerMiddlewareTest extends TestCase {
|
|||
|
||||
$this->l10n->expects($this->any())->method('t')
|
||||
->willReturnCallback(
|
||||
function($message) {
|
||||
function ($message) {
|
||||
return $message;
|
||||
}
|
||||
);
|
||||
|
|
|
@ -71,7 +71,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase {
|
|||
|
||||
/** @var \OCA\DAV\CardDAV\SyncService $syncService */
|
||||
$s = new SyncFederationAddressBooks($dbHandler, $syncService, $this->discoveryService);
|
||||
$s->syncThemAll(function($url, $ex) {
|
||||
$s->syncThemAll(function ($url, $ex) {
|
||||
$this->callBacks[] = [$url, $ex];
|
||||
});
|
||||
$this->assertEquals(1, count($this->callBacks));
|
||||
|
@ -99,7 +99,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase {
|
|||
|
||||
/** @var \OCA\DAV\CardDAV\SyncService $syncService */
|
||||
$s = new SyncFederationAddressBooks($dbHandler, $syncService, $this->discoveryService);
|
||||
$s->syncThemAll(function($url, $ex) {
|
||||
$s->syncThemAll(function ($url, $ex) {
|
||||
$this->callBacks[] = [$url, $ex];
|
||||
});
|
||||
$this->assertEquals(2, count($this->callBacks));
|
||||
|
|
|
@ -216,7 +216,7 @@ class TrustedServersTest extends TestCase {
|
|||
->willReturn($server);
|
||||
$this->dispatcher->expects($this->once())->method('dispatch')
|
||||
->willReturnCallback(
|
||||
function($eventId, $event) {
|
||||
function ($eventId, $event) {
|
||||
$this->assertSame($eventId, 'OCP\Federation\TrustedServerEvent::remove');
|
||||
$this->assertInstanceOf('Symfony\Component\EventDispatcher\GenericEvent', $event);
|
||||
/** @var \Symfony\Component\EventDispatcher\GenericEvent $event */
|
||||
|
|
|
@ -74,7 +74,7 @@ class Application extends App {
|
|||
/**
|
||||
* Services
|
||||
*/
|
||||
$container->registerService('TagService', function(IContainer $c) use ($server) {
|
||||
$container->registerService('TagService', function (IContainer $c) use ($server) {
|
||||
$homeFolder = $c->query('ServerContainer')->getUserFolder();
|
||||
return new TagService(
|
||||
$c->query('ServerContainer')->getUserSession(),
|
||||
|
|
|
@ -85,7 +85,7 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide
|
|||
$backendService = $container->query(BackendService::class);
|
||||
$backendService->registerBackendProvider($this);
|
||||
$backendService->registerAuthMechanismProvider($this);
|
||||
$backendService->registerConfigHandler('user', function() use ($container) {
|
||||
$backendService->registerConfigHandler('user', function () use ($container) {
|
||||
return $container->query(UserPlaceholderHandler::class);
|
||||
});
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ class ConfigAdapter implements IMountProvider {
|
|||
|
||||
$storageConfigs = $this->userGlobalStoragesService->getAllStoragesForUser();
|
||||
|
||||
$storages = array_map(function(StorageConfig $storageConfig) use ($user) {
|
||||
$storages = array_map(function (StorageConfig $storageConfig) use ($user) {
|
||||
try {
|
||||
$this->prepareStorageConfig($storageConfig, $user);
|
||||
return $this->constructStorage($storageConfig);
|
||||
|
@ -138,7 +138,7 @@ class ConfigAdapter implements IMountProvider {
|
|||
}, $storageConfigs);
|
||||
|
||||
|
||||
\OC\Files\Cache\Storage::getGlobalCache()->loadForStorageIds(array_map(function(Storage\IStorage $storage) {
|
||||
\OC\Files\Cache\Storage::getGlobalCache()->loadForStorageIds(array_map(function (Storage\IStorage $storage) {
|
||||
return $storage->getId();
|
||||
}, $storages));
|
||||
|
||||
|
@ -157,7 +157,7 @@ class ConfigAdapter implements IMountProvider {
|
|||
return $storage;
|
||||
}, $storages, $storageConfigs);
|
||||
|
||||
$mounts = array_map(function(StorageConfig $storageConfig, Storage\IStorage $storage) use ($user, $loader) {
|
||||
$mounts = array_map(function (StorageConfig $storageConfig, Storage\IStorage $storage) use ($user, $loader) {
|
||||
if ($storageConfig->getType() === StorageConfig::MOUNT_TYPE_PERSONAl) {
|
||||
return new PersonalMount(
|
||||
$this->userStoragesService,
|
||||
|
|
|
@ -52,7 +52,7 @@ class Swift extends Backend {
|
|||
->setFlag(DefinitionParameter::FLAG_OPTIONAL),
|
||||
])
|
||||
->addAuthScheme(AuthMechanism::SCHEME_OPENSTACK)
|
||||
->setLegacyAuthMechanismCallback(function(array $params) use ($openstackAuth, $rackspaceAuth) {
|
||||
->setLegacyAuthMechanismCallback(function (array $params) use ($openstackAuth, $rackspaceAuth) {
|
||||
if (isset($params['options']['key']) && $params['options']['key']) {
|
||||
return $rackspaceAuth;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue