Completed
Pull Request — master (#10075)
by
unknown
27:10
created
apps/dav/lib/AppInfo/Application.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
 		$dispatcher = $this->getContainer()->getServer()->getEventDispatcher();
71 71
 
72 72
 		// first time login event setup
73
-		$dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm) {
73
+		$dispatcher->addListener(IUser::class.'::firstLogin', function($event) use ($hm) {
74 74
 			if ($event instanceof GenericEvent) {
75 75
 				$hm->firstLogin($event->getSubject());
76 76
 			}
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
 	}
77 77
 
78 78
 	/**
79
-	 * @param IManager $contactsManager
79
+	 * @param IContactsManager $contactsManager
80 80
 	 */
81 81
 	public function setupSystemContactsProvider(IContactsManager $contactsManager) {
82 82
 		/** @var ContactsManager $cm */
Please login to merge, or discard this patch.
Indentation   +177 added lines, -177 removed lines patch added patch discarded remove patch
@@ -43,184 +43,184 @@
 block discarded – undo
43 43
 
44 44
 class Application extends App {
45 45
 
46
-	/**
47
-	 * Application constructor.
48
-	 */
49
-	public function __construct() {
50
-		parent::__construct('dav');
51
-
52
-		$container = $this->getContainer();
53
-		$server = $container->getServer();
54
-
55
-		$container->registerService(PhotoCache::class, function(SimpleContainer $s) use ($server) {
56
-			return new PhotoCache(
57
-				$server->getAppDataDir('dav-photocache')
58
-			);
59
-		});
60
-
61
-		/*
46
+    /**
47
+     * Application constructor.
48
+     */
49
+    public function __construct() {
50
+        parent::__construct('dav');
51
+
52
+        $container = $this->getContainer();
53
+        $server = $container->getServer();
54
+
55
+        $container->registerService(PhotoCache::class, function(SimpleContainer $s) use ($server) {
56
+            return new PhotoCache(
57
+                $server->getAppDataDir('dav-photocache')
58
+            );
59
+        });
60
+
61
+        /*
62 62
 		 * Register capabilities
63 63
 		 */
64
-		$container->registerCapability(Capabilities::class);
65
-	}
66
-
67
-	/**
68
-	 * @param IContactsManager $contactsManager
69
-	 * @param string $userID
70
-	 */
71
-	public function setupContactsProvider(IContactsManager $contactsManager, $userID) {
72
-		/** @var ContactsManager $cm */
73
-		$cm = $this->getContainer()->query(ContactsManager::class);
74
-		$urlGenerator = $this->getContainer()->getServer()->getURLGenerator();
75
-		$cm->setupContactsProvider($contactsManager, $userID, $urlGenerator);
76
-	}
77
-
78
-	/**
79
-	 * @param IManager $contactsManager
80
-	 */
81
-	public function setupSystemContactsProvider(IContactsManager $contactsManager) {
82
-		/** @var ContactsManager $cm */
83
-		$cm = $this->getContainer()->query(ContactsManager::class);
84
-		$urlGenerator = $this->getContainer()->getServer()->getURLGenerator();
85
-		$cm->setupSystemContactsProvider($contactsManager, $urlGenerator);
86
-	}
87
-
88
-	/**
89
-	 * @param ICalendarManager $calendarManager
90
-	 * @param string $userId
91
-	 */
92
-	public function setupCalendarProvider(ICalendarManager $calendarManager, $userId) {
93
-		$cm = $this->getContainer()->query(CalendarManager::class);
94
-		$cm->setupCalendarProvider($calendarManager, $userId);
95
-	}
96
-
97
-	public function registerHooks() {
98
-		/** @var HookManager $hm */
99
-		$hm = $this->getContainer()->query(HookManager::class);
100
-		$hm->setup();
101
-
102
-		$dispatcher = $this->getContainer()->getServer()->getEventDispatcher();
103
-
104
-		// first time login event setup
105
-		$dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm) {
106
-			if ($event instanceof GenericEvent) {
107
-				$hm->firstLogin($event->getSubject());
108
-			}
109
-		});
110
-
111
-		// carddav/caldav sync event setup
112
-		$listener = function($event) {
113
-			if ($event instanceof GenericEvent) {
114
-				/** @var BirthdayService $b */
115
-				$b = $this->getContainer()->query(BirthdayService::class);
116
-				$b->onCardChanged(
117
-					$event->getArgument('addressBookId'),
118
-					$event->getArgument('cardUri'),
119
-					$event->getArgument('cardData')
120
-				);
121
-			}
122
-		};
123
-
124
-		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::createCard', $listener);
125
-		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $listener);
126
-		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', function($event) {
127
-			if ($event instanceof GenericEvent) {
128
-				/** @var BirthdayService $b */
129
-				$b = $this->getContainer()->query(BirthdayService::class);
130
-				$b->onCardDeleted(
131
-					$event->getArgument('addressBookId'),
132
-					$event->getArgument('cardUri')
133
-				);
134
-			}
135
-		});
136
-
137
-		$clearPhotoCache = function($event) {
138
-			if ($event instanceof GenericEvent) {
139
-				/** @var PhotoCache $p */
140
-				$p = $this->getContainer()->query(PhotoCache::class);
141
-				$p->delete(
142
-					$event->getArgument('addressBookId'),
143
-					$event->getArgument('cardUri')
144
-				);
145
-			}
146
-		};
147
-		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $clearPhotoCache);
148
-		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', $clearPhotoCache);
149
-
150
-		$dispatcher->addListener('OC\AccountManager::userUpdated', function(GenericEvent $event) {
151
-			$user = $event->getSubject();
152
-			$syncService = $this->getContainer()->query(SyncService::class);
153
-			$syncService->updateUser($user);
154
-		});
155
-
156
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', function(GenericEvent $event) {
157
-			/** @var Backend $backend */
158
-			$backend = $this->getContainer()->query(Backend::class);
159
-			$backend->onCalendarAdd(
160
-				$event->getArgument('calendarData')
161
-			);
162
-		});
163
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', function(GenericEvent $event) {
164
-			/** @var Backend $backend */
165
-			$backend = $this->getContainer()->query(Backend::class);
166
-			$backend->onCalendarUpdate(
167
-				$event->getArgument('calendarData'),
168
-				$event->getArgument('shares'),
169
-				$event->getArgument('propertyMutations')
170
-			);
171
-		});
172
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', function(GenericEvent $event) {
173
-			/** @var Backend $backend */
174
-			$backend = $this->getContainer()->query(Backend::class);
175
-			$backend->onCalendarDelete(
176
-				$event->getArgument('calendarData'),
177
-				$event->getArgument('shares')
178
-			);
179
-		});
180
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateShares', function(GenericEvent $event) {
181
-			/** @var Backend $backend */
182
-			$backend = $this->getContainer()->query(Backend::class);
183
-			$backend->onCalendarUpdateShares(
184
-				$event->getArgument('calendarData'),
185
-				$event->getArgument('shares'),
186
-				$event->getArgument('add'),
187
-				$event->getArgument('remove')
188
-			);
189
-		});
190
-
191
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', function(GenericEvent $event) {
192
-			/** @var Backend $backend */
193
-			$backend = $this->getContainer()->query(Backend::class);
194
-			$backend->onCalendarPublication(
195
-				$event->getArgument('calendarData'),
196
-				$event->getArgument('public')
197
-			);
198
-		});
199
-
200
-		$listener = function(GenericEvent $event, $eventName) {
201
-			/** @var Backend $backend */
202
-			$backend = $this->getContainer()->query(Backend::class);
203
-
204
-			$subject = Event::SUBJECT_OBJECT_ADD;
205
-			if ($eventName === '\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject') {
206
-				$subject = Event::SUBJECT_OBJECT_UPDATE;
207
-			} else if ($eventName === '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject') {
208
-				$subject = Event::SUBJECT_OBJECT_DELETE;
209
-			}
210
-			$backend->onTouchCalendarObject(
211
-				$subject,
212
-				$event->getArgument('calendarData'),
213
-				$event->getArgument('shares'),
214
-				$event->getArgument('objectData')
215
-			);
216
-		};
217
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', $listener);
218
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', $listener);
219
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', $listener);
220
-	}
221
-
222
-	public function getSyncService() {
223
-		return $this->getContainer()->query(SyncService::class);
224
-	}
64
+        $container->registerCapability(Capabilities::class);
65
+    }
66
+
67
+    /**
68
+     * @param IContactsManager $contactsManager
69
+     * @param string $userID
70
+     */
71
+    public function setupContactsProvider(IContactsManager $contactsManager, $userID) {
72
+        /** @var ContactsManager $cm */
73
+        $cm = $this->getContainer()->query(ContactsManager::class);
74
+        $urlGenerator = $this->getContainer()->getServer()->getURLGenerator();
75
+        $cm->setupContactsProvider($contactsManager, $userID, $urlGenerator);
76
+    }
77
+
78
+    /**
79
+     * @param IManager $contactsManager
80
+     */
81
+    public function setupSystemContactsProvider(IContactsManager $contactsManager) {
82
+        /** @var ContactsManager $cm */
83
+        $cm = $this->getContainer()->query(ContactsManager::class);
84
+        $urlGenerator = $this->getContainer()->getServer()->getURLGenerator();
85
+        $cm->setupSystemContactsProvider($contactsManager, $urlGenerator);
86
+    }
87
+
88
+    /**
89
+     * @param ICalendarManager $calendarManager
90
+     * @param string $userId
91
+     */
92
+    public function setupCalendarProvider(ICalendarManager $calendarManager, $userId) {
93
+        $cm = $this->getContainer()->query(CalendarManager::class);
94
+        $cm->setupCalendarProvider($calendarManager, $userId);
95
+    }
96
+
97
+    public function registerHooks() {
98
+        /** @var HookManager $hm */
99
+        $hm = $this->getContainer()->query(HookManager::class);
100
+        $hm->setup();
101
+
102
+        $dispatcher = $this->getContainer()->getServer()->getEventDispatcher();
103
+
104
+        // first time login event setup
105
+        $dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm) {
106
+            if ($event instanceof GenericEvent) {
107
+                $hm->firstLogin($event->getSubject());
108
+            }
109
+        });
110
+
111
+        // carddav/caldav sync event setup
112
+        $listener = function($event) {
113
+            if ($event instanceof GenericEvent) {
114
+                /** @var BirthdayService $b */
115
+                $b = $this->getContainer()->query(BirthdayService::class);
116
+                $b->onCardChanged(
117
+                    $event->getArgument('addressBookId'),
118
+                    $event->getArgument('cardUri'),
119
+                    $event->getArgument('cardData')
120
+                );
121
+            }
122
+        };
123
+
124
+        $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::createCard', $listener);
125
+        $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $listener);
126
+        $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', function($event) {
127
+            if ($event instanceof GenericEvent) {
128
+                /** @var BirthdayService $b */
129
+                $b = $this->getContainer()->query(BirthdayService::class);
130
+                $b->onCardDeleted(
131
+                    $event->getArgument('addressBookId'),
132
+                    $event->getArgument('cardUri')
133
+                );
134
+            }
135
+        });
136
+
137
+        $clearPhotoCache = function($event) {
138
+            if ($event instanceof GenericEvent) {
139
+                /** @var PhotoCache $p */
140
+                $p = $this->getContainer()->query(PhotoCache::class);
141
+                $p->delete(
142
+                    $event->getArgument('addressBookId'),
143
+                    $event->getArgument('cardUri')
144
+                );
145
+            }
146
+        };
147
+        $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $clearPhotoCache);
148
+        $dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', $clearPhotoCache);
149
+
150
+        $dispatcher->addListener('OC\AccountManager::userUpdated', function(GenericEvent $event) {
151
+            $user = $event->getSubject();
152
+            $syncService = $this->getContainer()->query(SyncService::class);
153
+            $syncService->updateUser($user);
154
+        });
155
+
156
+        $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', function(GenericEvent $event) {
157
+            /** @var Backend $backend */
158
+            $backend = $this->getContainer()->query(Backend::class);
159
+            $backend->onCalendarAdd(
160
+                $event->getArgument('calendarData')
161
+            );
162
+        });
163
+        $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', function(GenericEvent $event) {
164
+            /** @var Backend $backend */
165
+            $backend = $this->getContainer()->query(Backend::class);
166
+            $backend->onCalendarUpdate(
167
+                $event->getArgument('calendarData'),
168
+                $event->getArgument('shares'),
169
+                $event->getArgument('propertyMutations')
170
+            );
171
+        });
172
+        $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', function(GenericEvent $event) {
173
+            /** @var Backend $backend */
174
+            $backend = $this->getContainer()->query(Backend::class);
175
+            $backend->onCalendarDelete(
176
+                $event->getArgument('calendarData'),
177
+                $event->getArgument('shares')
178
+            );
179
+        });
180
+        $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateShares', function(GenericEvent $event) {
181
+            /** @var Backend $backend */
182
+            $backend = $this->getContainer()->query(Backend::class);
183
+            $backend->onCalendarUpdateShares(
184
+                $event->getArgument('calendarData'),
185
+                $event->getArgument('shares'),
186
+                $event->getArgument('add'),
187
+                $event->getArgument('remove')
188
+            );
189
+        });
190
+
191
+        $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', function(GenericEvent $event) {
192
+            /** @var Backend $backend */
193
+            $backend = $this->getContainer()->query(Backend::class);
194
+            $backend->onCalendarPublication(
195
+                $event->getArgument('calendarData'),
196
+                $event->getArgument('public')
197
+            );
198
+        });
199
+
200
+        $listener = function(GenericEvent $event, $eventName) {
201
+            /** @var Backend $backend */
202
+            $backend = $this->getContainer()->query(Backend::class);
203
+
204
+            $subject = Event::SUBJECT_OBJECT_ADD;
205
+            if ($eventName === '\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject') {
206
+                $subject = Event::SUBJECT_OBJECT_UPDATE;
207
+            } else if ($eventName === '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject') {
208
+                $subject = Event::SUBJECT_OBJECT_DELETE;
209
+            }
210
+            $backend->onTouchCalendarObject(
211
+                $subject,
212
+                $event->getArgument('calendarData'),
213
+                $event->getArgument('shares'),
214
+                $event->getArgument('objectData')
215
+            );
216
+        };
217
+        $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', $listener);
218
+        $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', $listener);
219
+        $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', $listener);
220
+    }
221
+
222
+    public function getSyncService() {
223
+        return $this->getContainer()->query(SyncService::class);
224
+    }
225 225
 
226 226
 }
Please login to merge, or discard this patch.
apps/dav/lib/Migration/FixBirthdayCalendarComponent.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -28,35 +28,35 @@
 block discarded – undo
28 28
 
29 29
 class FixBirthdayCalendarComponent implements IRepairStep {
30 30
 
31
-	/** @var IDBConnection */
32
-	private $connection;
33
-
34
-	/**
35
-	 * FixBirthdayCalendarComponent constructor.
36
-	 *
37
-	 * @param IDBConnection $connection
38
-	 */
39
-	public function __construct(IDBConnection $connection) {
40
-		$this->connection = $connection;
41
-	}
42
-
43
-	/**
44
-	 * @inheritdoc
45
-	 */
46
-	public function getName() {
47
-		return 'Fix component of birthday calendars';
48
-	}
49
-
50
-	/**
51
-	 * @inheritdoc
52
-	 */
53
-	public function run(IOutput $output) {
54
-		$query = $this->connection->getQueryBuilder();
55
-		$updated = $query->update('calendars')
56
-			->set('components', $query->createNamedParameter('VEVENT'))
57
-			->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)))
58
-			->execute();
59
-
60
-		$output->info("$updated birthday calendars updated.");
61
-	}
31
+    /** @var IDBConnection */
32
+    private $connection;
33
+
34
+    /**
35
+     * FixBirthdayCalendarComponent constructor.
36
+     *
37
+     * @param IDBConnection $connection
38
+     */
39
+    public function __construct(IDBConnection $connection) {
40
+        $this->connection = $connection;
41
+    }
42
+
43
+    /**
44
+     * @inheritdoc
45
+     */
46
+    public function getName() {
47
+        return 'Fix component of birthday calendars';
48
+    }
49
+
50
+    /**
51
+     * @inheritdoc
52
+     */
53
+    public function run(IOutput $output) {
54
+        $query = $this->connection->getQueryBuilder();
55
+        $updated = $query->update('calendars')
56
+            ->set('components', $query->createNamedParameter('VEVENT'))
57
+            ->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)))
58
+            ->execute();
59
+
60
+        $output->info("$updated birthday calendars updated.");
61
+    }
62 62
 }
Please login to merge, or discard this patch.
apps/dav/lib/Command/SyncSystemAddressBook.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -31,36 +31,36 @@
 block discarded – undo
31 31
 
32 32
 class SyncSystemAddressBook extends Command {
33 33
 
34
-	/** @var SyncService */
35
-	private $syncService;
34
+    /** @var SyncService */
35
+    private $syncService;
36 36
 
37
-	/**
38
-	 * @param SyncService $syncService
39
-	 */
40
-	function __construct(SyncService $syncService) {
41
-		parent::__construct();
42
-		$this->syncService = $syncService;
43
-	}
37
+    /**
38
+     * @param SyncService $syncService
39
+     */
40
+    function __construct(SyncService $syncService) {
41
+        parent::__construct();
42
+        $this->syncService = $syncService;
43
+    }
44 44
 
45
-	protected function configure() {
46
-		$this
47
-			->setName('dav:sync-system-addressbook')
48
-			->setDescription('Synchronizes users to the system addressbook');
49
-	}
45
+    protected function configure() {
46
+        $this
47
+            ->setName('dav:sync-system-addressbook')
48
+            ->setDescription('Synchronizes users to the system addressbook');
49
+    }
50 50
 
51
-	/**
52
-	 * @param InputInterface $input
53
-	 * @param OutputInterface $output
54
-	 */
55
-	protected function execute(InputInterface $input, OutputInterface $output) {
56
-		$output->writeln('Syncing users ...');
57
-		$progress = new ProgressBar($output);
58
-		$progress->start();
59
-		$this->syncService->syncInstance(function() use ($progress) {
60
-			$progress->advance();
61
-		});
51
+    /**
52
+     * @param InputInterface $input
53
+     * @param OutputInterface $output
54
+     */
55
+    protected function execute(InputInterface $input, OutputInterface $output) {
56
+        $output->writeln('Syncing users ...');
57
+        $progress = new ProgressBar($output);
58
+        $progress->start();
59
+        $this->syncService->syncInstance(function() use ($progress) {
60
+            $progress->advance();
61
+        });
62 62
 
63
-		$progress->finish();
64
-		$output->writeln('');
65
-	}
63
+        $progress->finish();
64
+        $output->writeln('');
65
+    }
66 66
 }
Please login to merge, or discard this patch.
apps/dav/lib/Command/CreateAddressBook.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -36,43 +36,43 @@
 block discarded – undo
36 36
 
37 37
 class CreateAddressBook extends Command {
38 38
 
39
-	/** @var IUserManager */
40
-	private $userManager;
39
+    /** @var IUserManager */
40
+    private $userManager;
41 41
 
42
-	/** @var CardDavBackend */
43
-	private $cardDavBackend;
42
+    /** @var CardDavBackend */
43
+    private $cardDavBackend;
44 44
 
45
-	/**
46
-	 * @param IUserManager $userManager
47
-	 * @param CardDavBackend $cardDavBackend
48
-	 */
49
-	function __construct(IUserManager $userManager,
50
-						 CardDavBackend $cardDavBackend
51
-	) {
52
-		parent::__construct();
53
-		$this->userManager = $userManager;
54
-		$this->cardDavBackend = $cardDavBackend;
55
-	}
45
+    /**
46
+     * @param IUserManager $userManager
47
+     * @param CardDavBackend $cardDavBackend
48
+     */
49
+    function __construct(IUserManager $userManager,
50
+                            CardDavBackend $cardDavBackend
51
+    ) {
52
+        parent::__construct();
53
+        $this->userManager = $userManager;
54
+        $this->cardDavBackend = $cardDavBackend;
55
+    }
56 56
 
57
-	protected function configure() {
58
-		$this
59
-				->setName('dav:create-addressbook')
60
-				->setDescription('Create a dav addressbook')
61
-				->addArgument('user',
62
-						InputArgument::REQUIRED,
63
-						'User for whom the addressbook will be created')
64
-				->addArgument('name',
65
-						InputArgument::REQUIRED,
66
-						'Name of the addressbook');
67
-	}
57
+    protected function configure() {
58
+        $this
59
+                ->setName('dav:create-addressbook')
60
+                ->setDescription('Create a dav addressbook')
61
+                ->addArgument('user',
62
+                        InputArgument::REQUIRED,
63
+                        'User for whom the addressbook will be created')
64
+                ->addArgument('name',
65
+                        InputArgument::REQUIRED,
66
+                        'Name of the addressbook');
67
+    }
68 68
 
69
-	protected function execute(InputInterface $input, OutputInterface $output) {
70
-		$user = $input->getArgument('user');
71
-		if (!$this->userManager->userExists($user)) {
72
-			throw new \InvalidArgumentException("User <$user> in unknown.");
73
-		}
69
+    protected function execute(InputInterface $input, OutputInterface $output) {
70
+        $user = $input->getArgument('user');
71
+        if (!$this->userManager->userExists($user)) {
72
+            throw new \InvalidArgumentException("User <$user> in unknown.");
73
+        }
74 74
 
75
-		$name = $input->getArgument('name');
76
-		$this->cardDavBackend->createAddressBook("principals/users/$user", $name, []);
77
-	}
75
+        $name = $input->getArgument('name');
76
+        $this->cardDavBackend->createAddressBook("principals/users/$user", $name, []);
77
+    }
78 78
 }
Please login to merge, or discard this patch.
apps/dav/lib/Capabilities.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@
 block discarded – undo
26 26
 
27 27
 class Capabilities implements ICapability {
28 28
 
29
-	public function getCapabilities() {
30
-		return [
31
-			'dav' => [
32
-				'chunking' => '1.0',
33
-			]
34
-		];
35
-	}
29
+    public function getCapabilities() {
30
+        return [
31
+            'dav' => [
32
+                'chunking' => '1.0',
33
+            ]
34
+        ];
35
+    }
36 36
 }
Please login to merge, or discard this patch.
apps/dav/lib/Files/BrowserErrorPagePlugin.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -31,78 +31,78 @@
 block discarded – undo
31 31
 use Sabre\DAV\ServerPlugin;
32 32
 
33 33
 class BrowserErrorPagePlugin extends ServerPlugin {
34
-	/** @var Server */
35
-	private $server;
34
+    /** @var Server */
35
+    private $server;
36 36
 
37
-	/**
38
-	 * This initializes the plugin.
39
-	 *
40
-	 * This function is called by Sabre\DAV\Server, after
41
-	 * addPlugin is called.
42
-	 *
43
-	 * This method should set up the required event subscriptions.
44
-	 *
45
-	 * @param Server $server
46
-	 * @return void
47
-	 */
48
-	function initialize(Server $server) {
49
-		$this->server = $server;
50
-		$server->on('exception', array($this, 'logException'), 1000);
51
-	}
37
+    /**
38
+     * This initializes the plugin.
39
+     *
40
+     * This function is called by Sabre\DAV\Server, after
41
+     * addPlugin is called.
42
+     *
43
+     * This method should set up the required event subscriptions.
44
+     *
45
+     * @param Server $server
46
+     * @return void
47
+     */
48
+    function initialize(Server $server) {
49
+        $this->server = $server;
50
+        $server->on('exception', array($this, 'logException'), 1000);
51
+    }
52 52
 
53
-	/**
54
-	 * @param IRequest $request
55
-	 * @return bool
56
-	 */
57
-	public static function isBrowserRequest(IRequest $request) {
58
-		if ($request->getMethod() !== 'GET') {
59
-			return false;
60
-		}
61
-		return $request->isUserAgent([
62
-			Request::USER_AGENT_IE,
63
-			Request::USER_AGENT_MS_EDGE,
64
-			Request::USER_AGENT_CHROME,
65
-			Request::USER_AGENT_FIREFOX,
66
-			Request::USER_AGENT_SAFARI,
67
-		]);
68
-	}
53
+    /**
54
+     * @param IRequest $request
55
+     * @return bool
56
+     */
57
+    public static function isBrowserRequest(IRequest $request) {
58
+        if ($request->getMethod() !== 'GET') {
59
+            return false;
60
+        }
61
+        return $request->isUserAgent([
62
+            Request::USER_AGENT_IE,
63
+            Request::USER_AGENT_MS_EDGE,
64
+            Request::USER_AGENT_CHROME,
65
+            Request::USER_AGENT_FIREFOX,
66
+            Request::USER_AGENT_SAFARI,
67
+        ]);
68
+    }
69 69
 
70
-	/**
71
-	 * @param \Exception $ex
72
-	 */
73
-	public function logException(\Exception $ex) {
74
-		if ($ex instanceof Exception) {
75
-			$httpCode = $ex->getHTTPCode();
76
-			$headers = $ex->getHTTPHeaders($this->server);
77
-		} else {
78
-			$httpCode = 500;
79
-			$headers = [];
80
-		}
81
-		$this->server->httpResponse->addHeaders($headers);
82
-		$this->server->httpResponse->setStatus($httpCode);
83
-		$body = $this->generateBody();
84
-		$this->server->httpResponse->setBody($body);
85
-		$this->sendResponse();
86
-	}
70
+    /**
71
+     * @param \Exception $ex
72
+     */
73
+    public function logException(\Exception $ex) {
74
+        if ($ex instanceof Exception) {
75
+            $httpCode = $ex->getHTTPCode();
76
+            $headers = $ex->getHTTPHeaders($this->server);
77
+        } else {
78
+            $httpCode = 500;
79
+            $headers = [];
80
+        }
81
+        $this->server->httpResponse->addHeaders($headers);
82
+        $this->server->httpResponse->setStatus($httpCode);
83
+        $body = $this->generateBody();
84
+        $this->server->httpResponse->setBody($body);
85
+        $this->sendResponse();
86
+    }
87 87
 
88
-	/**
89
-	 * @codeCoverageIgnore
90
-	 * @return bool|string
91
-	 */
92
-	public function generateBody() {
93
-		$request = \OC::$server->getRequest();
94
-		$content = new OC_Template('dav', 'exception', 'guest');
95
-		$content->assign('title', $this->server->httpResponse->getStatusText());
96
-		$content->assign('remoteAddr', $request->getRemoteAddress());
97
-		$content->assign('requestID', $request->getId());
98
-		return $content->fetchPage();
99
-	}
88
+    /**
89
+     * @codeCoverageIgnore
90
+     * @return bool|string
91
+     */
92
+    public function generateBody() {
93
+        $request = \OC::$server->getRequest();
94
+        $content = new OC_Template('dav', 'exception', 'guest');
95
+        $content->assign('title', $this->server->httpResponse->getStatusText());
96
+        $content->assign('remoteAddr', $request->getRemoteAddress());
97
+        $content->assign('requestID', $request->getId());
98
+        return $content->fetchPage();
99
+    }
100 100
 
101
-	/**
102
-	 * @codeCoverageIgnore
103
-	 */
104
-	public function sendResponse() {
105
-		$this->server->sapi->sendResponse($this->server->httpResponse);
106
-		exit();
107
-	}
101
+    /**
102
+     * @codeCoverageIgnore
103
+     */
104
+    public function sendResponse() {
105
+        $this->server->sapi->sendResponse($this->server->httpResponse);
106
+        exit();
107
+    }
108 108
 }
Please login to merge, or discard this patch.
apps/dav/lib/Files/Sharing/PublicLinkCheckPlugin.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -32,33 +32,33 @@
 block discarded – undo
32 32
  * Verify that the public link share is valid
33 33
  */
34 34
 class PublicLinkCheckPlugin extends ServerPlugin {
35
-	/**
36
-	 * @var FileInfo
37
-	 */
38
-	private $fileInfo;
35
+    /**
36
+     * @var FileInfo
37
+     */
38
+    private $fileInfo;
39 39
 
40
-	/**
41
-	 * @param FileInfo $fileInfo
42
-	 */
43
-	public function setFileInfo($fileInfo) {
44
-		$this->fileInfo = $fileInfo;
45
-	}
40
+    /**
41
+     * @param FileInfo $fileInfo
42
+     */
43
+    public function setFileInfo($fileInfo) {
44
+        $this->fileInfo = $fileInfo;
45
+    }
46 46
 
47
-	/**
48
-	 * This initializes the plugin.
49
-	 *
50
-	 * @param \Sabre\DAV\Server $server Sabre server
51
-	 *
52
-	 * @return void
53
-	 */
54
-	public function initialize(\Sabre\DAV\Server $server) {
55
-		$server->on('beforeMethod', [$this, 'beforeMethod']);
56
-	}
47
+    /**
48
+     * This initializes the plugin.
49
+     *
50
+     * @param \Sabre\DAV\Server $server Sabre server
51
+     *
52
+     * @return void
53
+     */
54
+    public function initialize(\Sabre\DAV\Server $server) {
55
+        $server->on('beforeMethod', [$this, 'beforeMethod']);
56
+    }
57 57
 
58
-	public function beforeMethod(RequestInterface $request, ResponseInterface $response){
59
-		// verify that the owner didn't have his share permissions revoked
60
-		if ($this->fileInfo && !$this->fileInfo->isShareable()) {
61
-			throw new NotFound();
62
-		}
63
-	}
58
+    public function beforeMethod(RequestInterface $request, ResponseInterface $response){
59
+        // verify that the owner didn't have his share permissions revoked
60
+        if ($this->fileInfo && !$this->fileInfo->isShareable()) {
61
+            throw new NotFound();
62
+        }
63
+    }
64 64
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 		$server->on('beforeMethod', [$this, 'beforeMethod']);
56 56
 	}
57 57
 
58
-	public function beforeMethod(RequestInterface $request, ResponseInterface $response){
58
+	public function beforeMethod(RequestInterface $request, ResponseInterface $response) {
59 59
 		// verify that the owner didn't have his share permissions revoked
60 60
 		if ($this->fileInfo && !$this->fileInfo->isShareable()) {
61 61
 			throw new NotFound();
Please login to merge, or discard this patch.
apps/dav/lib/Files/Sharing/FilesDropPlugin.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -33,52 +33,52 @@
 block discarded – undo
33 33
  */
34 34
 class FilesDropPlugin extends ServerPlugin {
35 35
 
36
-	/** @var View */
37
-	private $view;
36
+    /** @var View */
37
+    private $view;
38 38
 
39
-	/** @var bool */
40
-	private $enabled = false;
39
+    /** @var bool */
40
+    private $enabled = false;
41 41
 
42
-	/**
43
-	 * @param View $view
44
-	 */
45
-	public function setView($view) {
46
-		$this->view = $view;
47
-	}
42
+    /**
43
+     * @param View $view
44
+     */
45
+    public function setView($view) {
46
+        $this->view = $view;
47
+    }
48 48
 
49
-	public function enable() {
50
-		$this->enabled = true;
51
-	}
49
+    public function enable() {
50
+        $this->enabled = true;
51
+    }
52 52
 
53 53
 
54
-	/**
55
-	 * This initializes the plugin.
56
-	 *
57
-	 * @param \Sabre\DAV\Server $server Sabre server
58
-	 *
59
-	 * @return void
60
-	 * @throws MethodNotAllowed
61
-	 */
62
-	public function initialize(\Sabre\DAV\Server $server) {
63
-		$server->on('beforeMethod', [$this, 'beforeMethod'], 999);
64
-		$this->enabled = false;
65
-	}
54
+    /**
55
+     * This initializes the plugin.
56
+     *
57
+     * @param \Sabre\DAV\Server $server Sabre server
58
+     *
59
+     * @return void
60
+     * @throws MethodNotAllowed
61
+     */
62
+    public function initialize(\Sabre\DAV\Server $server) {
63
+        $server->on('beforeMethod', [$this, 'beforeMethod'], 999);
64
+        $this->enabled = false;
65
+    }
66 66
 
67
-	public function beforeMethod(RequestInterface $request, ResponseInterface $response){
67
+    public function beforeMethod(RequestInterface $request, ResponseInterface $response){
68 68
 
69
-		if (!$this->enabled) {
70
-			return;
71
-		}
69
+        if (!$this->enabled) {
70
+            return;
71
+        }
72 72
 
73
-		if ($request->getMethod() !== 'PUT') {
74
-			throw new MethodNotAllowed('Only PUT is allowed on files drop');
75
-		}
73
+        if ($request->getMethod() !== 'PUT') {
74
+            throw new MethodNotAllowed('Only PUT is allowed on files drop');
75
+        }
76 76
 
77
-		$path = explode('/', $request->getPath());
78
-		$path = array_pop($path);
77
+        $path = explode('/', $request->getPath());
78
+        $path = array_pop($path);
79 79
 
80
-		$newName = \OC_Helper::buildNotExistingFileNameForView('/', $path, $this->view);
81
-		$url = $request->getBaseUrl() . $newName;
82
-		$request->setUrl($url);
83
-	}
80
+        $newName = \OC_Helper::buildNotExistingFileNameForView('/', $path, $this->view);
81
+        $url = $request->getBaseUrl() . $newName;
82
+        $request->setUrl($url);
83
+    }
84 84
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 		$this->enabled = false;
65 65
 	}
66 66
 
67
-	public function beforeMethod(RequestInterface $request, ResponseInterface $response){
67
+	public function beforeMethod(RequestInterface $request, ResponseInterface $response) {
68 68
 
69 69
 		if (!$this->enabled) {
70 70
 			return;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		$path = array_pop($path);
79 79
 
80 80
 		$newName = \OC_Helper::buildNotExistingFileNameForView('/', $path, $this->view);
81
-		$url = $request->getBaseUrl() . $newName;
81
+		$url = $request->getBaseUrl().$newName;
82 82
 		$request->setUrl($url);
83 83
 	}
84 84
 }
Please login to merge, or discard this patch.
apps/dav/lib/Upload/UploadFolder.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -28,54 +28,54 @@
 block discarded – undo
28 28
 
29 29
 class UploadFolder implements ICollection {
30 30
 
31
-	private $node;
31
+    private $node;
32 32
 
33
-	function __construct(Directory $node) {
34
-		$this->node = $node;
35
-	}
33
+    function __construct(Directory $node) {
34
+        $this->node = $node;
35
+    }
36 36
 
37
-	function createFile($name, $data = null) {
38
-		// TODO: verify name - should be a simple number
39
-		$this->node->createFile($name, $data);
40
-	}
37
+    function createFile($name, $data = null) {
38
+        // TODO: verify name - should be a simple number
39
+        $this->node->createFile($name, $data);
40
+    }
41 41
 
42
-	function createDirectory($name) {
43
-		throw new Forbidden('Permission denied to create file (filename ' . $name . ')');
44
-	}
42
+    function createDirectory($name) {
43
+        throw new Forbidden('Permission denied to create file (filename ' . $name . ')');
44
+    }
45 45
 
46
-	function getChild($name) {
47
-		if ($name === '.file') {
48
-			return new FutureFile($this->node, '.file');
49
-		}
50
-		return $this->node->getChild($name);
51
-	}
46
+    function getChild($name) {
47
+        if ($name === '.file') {
48
+            return new FutureFile($this->node, '.file');
49
+        }
50
+        return $this->node->getChild($name);
51
+    }
52 52
 
53
-	function getChildren() {
54
-		$children = $this->node->getChildren();
55
-		$children[] = new FutureFile($this->node, '.file');
56
-		return $children;
57
-	}
53
+    function getChildren() {
54
+        $children = $this->node->getChildren();
55
+        $children[] = new FutureFile($this->node, '.file');
56
+        return $children;
57
+    }
58 58
 
59
-	function childExists($name) {
60
-		if ($name === '.file') {
61
-			return true;
62
-		}
63
-		return $this->node->childExists($name);
64
-	}
59
+    function childExists($name) {
60
+        if ($name === '.file') {
61
+            return true;
62
+        }
63
+        return $this->node->childExists($name);
64
+    }
65 65
 
66
-	function delete() {
67
-		$this->node->delete();
68
-	}
66
+    function delete() {
67
+        $this->node->delete();
68
+    }
69 69
 
70
-	function getName() {
71
-		return $this->node->getName();
72
-	}
70
+    function getName() {
71
+        return $this->node->getName();
72
+    }
73 73
 
74
-	function setName($name) {
75
-		throw new Forbidden('Permission denied to rename this folder');
76
-	}
74
+    function setName($name) {
75
+        throw new Forbidden('Permission denied to rename this folder');
76
+    }
77 77
 
78
-	function getLastModified() {
79
-		return $this->node->getLastModified();
80
-	}
78
+    function getLastModified() {
79
+        return $this->node->getLastModified();
80
+    }
81 81
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
 	}
41 41
 
42 42
 	function createDirectory($name) {
43
-		throw new Forbidden('Permission denied to create file (filename ' . $name . ')');
43
+		throw new Forbidden('Permission denied to create file (filename '.$name.')');
44 44
 	}
45 45
 
46 46
 	function getChild($name) {
Please login to merge, or discard this patch.