Passed
Push — master ( 4a4262...32927f )
by Roeland
24:24 queued 11:41
created
apps/federatedfilesharing/appinfo/routes.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -23,18 +23,18 @@
 block discarded – undo
23 23
  */
24 24
 
25 25
 return [
26
-	'routes' => [
27
-		['name' => 'MountPublicLink#createFederatedShare', 'url' => '/createFederatedShare', 'verb' => 'POST'],
28
-		['name' => 'MountPublicLink#askForFederatedShare', 'url' => '/askForFederatedShare', 'verb' => 'POST'],
29
-	],
30
-	'ocs' => [
31
-		['root' => '/cloud', 'name' => 'RequestHandler#createShare', 'url' => '/shares', 'verb' => 'POST'],
32
-		['root' => '/cloud', 'name' => 'RequestHandler#reShare', 'url' => '/shares/{id}/reshare', 'verb' => 'POST'],
33
-		['root' => '/cloud', 'name' => 'RequestHandler#updatePermissions', 'url' => '/shares/{id}/permissions', 'verb' => 'POST'],
34
-		['root' => '/cloud', 'name' => 'RequestHandler#acceptShare', 'url' => '/shares/{id}/accept', 'verb' => 'POST'],
35
-		['root' => '/cloud', 'name' => 'RequestHandler#declineShare', 'url' => '/shares/{id}/decline', 'verb' => 'POST'],
36
-		['root' => '/cloud', 'name' => 'RequestHandler#unshare', 'url' => '/shares/{id}/unshare', 'verb' => 'POST'],
37
-		['root' => '/cloud', 'name' => 'RequestHandler#revoke', 'url' => '/shares/{id}/revoke', 'verb' => 'POST'],
38
-		['root' => '/cloud', 'name' => 'RequestHandler#move', 'url' => '/shares/{id}/move', 'verb' => 'POST'],
39
-	],
26
+    'routes' => [
27
+        ['name' => 'MountPublicLink#createFederatedShare', 'url' => '/createFederatedShare', 'verb' => 'POST'],
28
+        ['name' => 'MountPublicLink#askForFederatedShare', 'url' => '/askForFederatedShare', 'verb' => 'POST'],
29
+    ],
30
+    'ocs' => [
31
+        ['root' => '/cloud', 'name' => 'RequestHandler#createShare', 'url' => '/shares', 'verb' => 'POST'],
32
+        ['root' => '/cloud', 'name' => 'RequestHandler#reShare', 'url' => '/shares/{id}/reshare', 'verb' => 'POST'],
33
+        ['root' => '/cloud', 'name' => 'RequestHandler#updatePermissions', 'url' => '/shares/{id}/permissions', 'verb' => 'POST'],
34
+        ['root' => '/cloud', 'name' => 'RequestHandler#acceptShare', 'url' => '/shares/{id}/accept', 'verb' => 'POST'],
35
+        ['root' => '/cloud', 'name' => 'RequestHandler#declineShare', 'url' => '/shares/{id}/decline', 'verb' => 'POST'],
36
+        ['root' => '/cloud', 'name' => 'RequestHandler#unshare', 'url' => '/shares/{id}/unshare', 'verb' => 'POST'],
37
+        ['root' => '/cloud', 'name' => 'RequestHandler#revoke', 'url' => '/shares/{id}/revoke', 'verb' => 'POST'],
38
+        ['root' => '/cloud', 'name' => 'RequestHandler#move', 'url' => '/shares/{id}/move', 'verb' => 'POST'],
39
+    ],
40 40
 ];
Please login to merge, or discard this patch.
apps/dav/appinfo/v2/remote.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
  */
22 22
 // no php execution timeout for webdav
23 23
 if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
24
-	@set_time_limit(0);
24
+    @set_time_limit(0);
25 25
 }
26 26
 ignore_user_abort(true);
27 27
 
Please login to merge, or discard this patch.
lib/private/Share20/ProviderFactory.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		}
215 215
 
216 216
 		if ($provider === null) {
217
-			throw new ProviderException('No provider with id .' . $id . ' found.');
217
+			throw new ProviderException('No provider with id .'.$id.' found.');
218 218
 		}
219 219
 
220 220
 		return $provider;
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
 
243 243
 		if ($provider === null) {
244
-			throw new ProviderException('No share provider for share type ' . $shareType);
244
+			throw new ProviderException('No share provider for share type '.$shareType);
245 245
 		}
246 246
 
247 247
 		return $provider;
Please login to merge, or discard this patch.
Indentation   +260 added lines, -260 removed lines patch added patch discarded remove patch
@@ -50,273 +50,273 @@
 block discarded – undo
50 50
  */
51 51
 class ProviderFactory implements IProviderFactory {
52 52
 
53
-	/** @var IServerContainer */
54
-	private $serverContainer;
55
-	/** @var DefaultShareProvider */
56
-	private $defaultProvider = null;
57
-	/** @var FederatedShareProvider */
58
-	private $federatedProvider = null;
59
-	/** @var  ShareByMailProvider */
60
-	private $shareByMailProvider;
61
-	/** @var  \OCA\Circles\ShareByCircleProvider */
62
-	private $shareByCircleProvider = null;
63
-	/** @var bool */
64
-	private $circlesAreNotAvailable = false;
65
-	/** @var \OCA\Talk\Share\RoomShareProvider */
66
-	private $roomShareProvider = null;
67
-
68
-	/**
69
-	 * IProviderFactory constructor.
70
-	 *
71
-	 * @param IServerContainer $serverContainer
72
-	 */
73
-	public function __construct(IServerContainer $serverContainer) {
74
-		$this->serverContainer = $serverContainer;
75
-	}
76
-
77
-	/**
78
-	 * Create the default share provider.
79
-	 *
80
-	 * @return DefaultShareProvider
81
-	 */
82
-	protected function defaultShareProvider() {
83
-		if ($this->defaultProvider === null) {
84
-			$this->defaultProvider = new DefaultShareProvider(
85
-				$this->serverContainer->getDatabaseConnection(),
86
-				$this->serverContainer->getUserManager(),
87
-				$this->serverContainer->getGroupManager(),
88
-				$this->serverContainer->getLazyRootFolder(),
89
-				$this->serverContainer->getMailer(),
90
-				$this->serverContainer->query(Defaults::class),
91
-				$this->serverContainer->getL10NFactory(),
92
-				$this->serverContainer->getURLGenerator(),
93
-				$this->serverContainer->getConfig()
94
-			);
95
-		}
96
-
97
-		return $this->defaultProvider;
98
-	}
99
-
100
-	/**
101
-	 * Create the federated share provider
102
-	 *
103
-	 * @return FederatedShareProvider
104
-	 */
105
-	protected function federatedShareProvider() {
106
-		if ($this->federatedProvider === null) {
107
-			/*
53
+    /** @var IServerContainer */
54
+    private $serverContainer;
55
+    /** @var DefaultShareProvider */
56
+    private $defaultProvider = null;
57
+    /** @var FederatedShareProvider */
58
+    private $federatedProvider = null;
59
+    /** @var  ShareByMailProvider */
60
+    private $shareByMailProvider;
61
+    /** @var  \OCA\Circles\ShareByCircleProvider */
62
+    private $shareByCircleProvider = null;
63
+    /** @var bool */
64
+    private $circlesAreNotAvailable = false;
65
+    /** @var \OCA\Talk\Share\RoomShareProvider */
66
+    private $roomShareProvider = null;
67
+
68
+    /**
69
+     * IProviderFactory constructor.
70
+     *
71
+     * @param IServerContainer $serverContainer
72
+     */
73
+    public function __construct(IServerContainer $serverContainer) {
74
+        $this->serverContainer = $serverContainer;
75
+    }
76
+
77
+    /**
78
+     * Create the default share provider.
79
+     *
80
+     * @return DefaultShareProvider
81
+     */
82
+    protected function defaultShareProvider() {
83
+        if ($this->defaultProvider === null) {
84
+            $this->defaultProvider = new DefaultShareProvider(
85
+                $this->serverContainer->getDatabaseConnection(),
86
+                $this->serverContainer->getUserManager(),
87
+                $this->serverContainer->getGroupManager(),
88
+                $this->serverContainer->getLazyRootFolder(),
89
+                $this->serverContainer->getMailer(),
90
+                $this->serverContainer->query(Defaults::class),
91
+                $this->serverContainer->getL10NFactory(),
92
+                $this->serverContainer->getURLGenerator(),
93
+                $this->serverContainer->getConfig()
94
+            );
95
+        }
96
+
97
+        return $this->defaultProvider;
98
+    }
99
+
100
+    /**
101
+     * Create the federated share provider
102
+     *
103
+     * @return FederatedShareProvider
104
+     */
105
+    protected function federatedShareProvider() {
106
+        if ($this->federatedProvider === null) {
107
+            /*
108 108
 			 * Check if the app is enabled
109 109
 			 */
110
-			$appManager = $this->serverContainer->getAppManager();
111
-			if (!$appManager->isEnabledForUser('federatedfilesharing')) {
112
-				return null;
113
-			}
110
+            $appManager = $this->serverContainer->getAppManager();
111
+            if (!$appManager->isEnabledForUser('federatedfilesharing')) {
112
+                return null;
113
+            }
114 114
 
115
-			/*
115
+            /*
116 116
 			 * TODO: add factory to federated sharing app
117 117
 			 */
118
-			$l = $this->serverContainer->getL10N('federatedfilesharing');
119
-			$addressHandler = new AddressHandler(
120
-				$this->serverContainer->getURLGenerator(),
121
-				$l,
122
-				$this->serverContainer->getCloudIdManager()
123
-			);
124
-			$notifications = new Notifications(
125
-				$addressHandler,
126
-				$this->serverContainer->getHTTPClientService(),
127
-				$this->serverContainer->query(\OCP\OCS\IDiscoveryService::class),
128
-				$this->serverContainer->getJobList(),
129
-				\OC::$server->getCloudFederationProviderManager(),
130
-				\OC::$server->getCloudFederationFactory()
131
-			);
132
-			$tokenHandler = new TokenHandler(
133
-				$this->serverContainer->getSecureRandom()
134
-			);
135
-
136
-			$this->federatedProvider = new FederatedShareProvider(
137
-				$this->serverContainer->getDatabaseConnection(),
138
-				$addressHandler,
139
-				$notifications,
140
-				$tokenHandler,
141
-				$l,
142
-				$this->serverContainer->getLogger(),
143
-				$this->serverContainer->getLazyRootFolder(),
144
-				$this->serverContainer->getConfig(),
145
-				$this->serverContainer->getUserManager(),
146
-				$this->serverContainer->getCloudIdManager(),
147
-				$this->serverContainer->getGlobalScaleConfig(),
148
-				$this->serverContainer->getCloudFederationProviderManager()
149
-			);
150
-		}
151
-
152
-		return $this->federatedProvider;
153
-	}
154
-
155
-	/**
156
-	 * Create the federated share provider
157
-	 *
158
-	 * @return ShareByMailProvider
159
-	 */
160
-	protected function getShareByMailProvider() {
161
-		if ($this->shareByMailProvider === null) {
162
-			/*
118
+            $l = $this->serverContainer->getL10N('federatedfilesharing');
119
+            $addressHandler = new AddressHandler(
120
+                $this->serverContainer->getURLGenerator(),
121
+                $l,
122
+                $this->serverContainer->getCloudIdManager()
123
+            );
124
+            $notifications = new Notifications(
125
+                $addressHandler,
126
+                $this->serverContainer->getHTTPClientService(),
127
+                $this->serverContainer->query(\OCP\OCS\IDiscoveryService::class),
128
+                $this->serverContainer->getJobList(),
129
+                \OC::$server->getCloudFederationProviderManager(),
130
+                \OC::$server->getCloudFederationFactory()
131
+            );
132
+            $tokenHandler = new TokenHandler(
133
+                $this->serverContainer->getSecureRandom()
134
+            );
135
+
136
+            $this->federatedProvider = new FederatedShareProvider(
137
+                $this->serverContainer->getDatabaseConnection(),
138
+                $addressHandler,
139
+                $notifications,
140
+                $tokenHandler,
141
+                $l,
142
+                $this->serverContainer->getLogger(),
143
+                $this->serverContainer->getLazyRootFolder(),
144
+                $this->serverContainer->getConfig(),
145
+                $this->serverContainer->getUserManager(),
146
+                $this->serverContainer->getCloudIdManager(),
147
+                $this->serverContainer->getGlobalScaleConfig(),
148
+                $this->serverContainer->getCloudFederationProviderManager()
149
+            );
150
+        }
151
+
152
+        return $this->federatedProvider;
153
+    }
154
+
155
+    /**
156
+     * Create the federated share provider
157
+     *
158
+     * @return ShareByMailProvider
159
+     */
160
+    protected function getShareByMailProvider() {
161
+        if ($this->shareByMailProvider === null) {
162
+            /*
163 163
 			 * Check if the app is enabled
164 164
 			 */
165
-			$appManager = $this->serverContainer->getAppManager();
166
-			if (!$appManager->isEnabledForUser('sharebymail')) {
167
-				return null;
168
-			}
169
-
170
-			$settingsManager = new SettingsManager($this->serverContainer->getConfig());
171
-
172
-			$this->shareByMailProvider = new ShareByMailProvider(
173
-				$this->serverContainer->getDatabaseConnection(),
174
-				$this->serverContainer->getSecureRandom(),
175
-				$this->serverContainer->getUserManager(),
176
-				$this->serverContainer->getLazyRootFolder(),
177
-				$this->serverContainer->getL10N('sharebymail'),
178
-				$this->serverContainer->getLogger(),
179
-				$this->serverContainer->getMailer(),
180
-				$this->serverContainer->getURLGenerator(),
181
-				$this->serverContainer->getActivityManager(),
182
-				$settingsManager,
183
-				$this->serverContainer->query(Defaults::class),
184
-				$this->serverContainer->getHasher(),
185
-				$this->serverContainer->query(CapabilitiesManager::class)
186
-			);
187
-		}
188
-
189
-		return $this->shareByMailProvider;
190
-	}
191
-
192
-
193
-	/**
194
-	 * Create the circle share provider
195
-	 *
196
-	 * @return FederatedShareProvider
197
-	 *
198
-	 * @suppress PhanUndeclaredClassMethod
199
-	 */
200
-	protected function getShareByCircleProvider() {
201
-		if ($this->circlesAreNotAvailable) {
202
-			return null;
203
-		}
204
-
205
-		if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') ||
206
-			!class_exists('\OCA\Circles\ShareByCircleProvider')
207
-		) {
208
-			$this->circlesAreNotAvailable = true;
209
-			return null;
210
-		}
211
-
212
-		if ($this->shareByCircleProvider === null) {
213
-			$this->shareByCircleProvider = new \OCA\Circles\ShareByCircleProvider(
214
-				$this->serverContainer->getDatabaseConnection(),
215
-				$this->serverContainer->getSecureRandom(),
216
-				$this->serverContainer->getUserManager(),
217
-				$this->serverContainer->getLazyRootFolder(),
218
-				$this->serverContainer->getL10N('circles'),
219
-				$this->serverContainer->getLogger(),
220
-				$this->serverContainer->getURLGenerator()
221
-			);
222
-		}
223
-
224
-		return $this->shareByCircleProvider;
225
-	}
226
-
227
-	/**
228
-	 * Create the room share provider
229
-	 *
230
-	 * @return RoomShareProvider
231
-	 */
232
-	protected function getRoomShareProvider() {
233
-		if ($this->roomShareProvider === null) {
234
-			/*
165
+            $appManager = $this->serverContainer->getAppManager();
166
+            if (!$appManager->isEnabledForUser('sharebymail')) {
167
+                return null;
168
+            }
169
+
170
+            $settingsManager = new SettingsManager($this->serverContainer->getConfig());
171
+
172
+            $this->shareByMailProvider = new ShareByMailProvider(
173
+                $this->serverContainer->getDatabaseConnection(),
174
+                $this->serverContainer->getSecureRandom(),
175
+                $this->serverContainer->getUserManager(),
176
+                $this->serverContainer->getLazyRootFolder(),
177
+                $this->serverContainer->getL10N('sharebymail'),
178
+                $this->serverContainer->getLogger(),
179
+                $this->serverContainer->getMailer(),
180
+                $this->serverContainer->getURLGenerator(),
181
+                $this->serverContainer->getActivityManager(),
182
+                $settingsManager,
183
+                $this->serverContainer->query(Defaults::class),
184
+                $this->serverContainer->getHasher(),
185
+                $this->serverContainer->query(CapabilitiesManager::class)
186
+            );
187
+        }
188
+
189
+        return $this->shareByMailProvider;
190
+    }
191
+
192
+
193
+    /**
194
+     * Create the circle share provider
195
+     *
196
+     * @return FederatedShareProvider
197
+     *
198
+     * @suppress PhanUndeclaredClassMethod
199
+     */
200
+    protected function getShareByCircleProvider() {
201
+        if ($this->circlesAreNotAvailable) {
202
+            return null;
203
+        }
204
+
205
+        if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') ||
206
+            !class_exists('\OCA\Circles\ShareByCircleProvider')
207
+        ) {
208
+            $this->circlesAreNotAvailable = true;
209
+            return null;
210
+        }
211
+
212
+        if ($this->shareByCircleProvider === null) {
213
+            $this->shareByCircleProvider = new \OCA\Circles\ShareByCircleProvider(
214
+                $this->serverContainer->getDatabaseConnection(),
215
+                $this->serverContainer->getSecureRandom(),
216
+                $this->serverContainer->getUserManager(),
217
+                $this->serverContainer->getLazyRootFolder(),
218
+                $this->serverContainer->getL10N('circles'),
219
+                $this->serverContainer->getLogger(),
220
+                $this->serverContainer->getURLGenerator()
221
+            );
222
+        }
223
+
224
+        return $this->shareByCircleProvider;
225
+    }
226
+
227
+    /**
228
+     * Create the room share provider
229
+     *
230
+     * @return RoomShareProvider
231
+     */
232
+    protected function getRoomShareProvider() {
233
+        if ($this->roomShareProvider === null) {
234
+            /*
235 235
 			 * Check if the app is enabled
236 236
 			 */
237
-			$appManager = $this->serverContainer->getAppManager();
238
-			if (!$appManager->isEnabledForUser('spreed')) {
239
-				return null;
240
-			}
241
-
242
-			try {
243
-				$this->roomShareProvider = $this->serverContainer->query('\OCA\Talk\Share\RoomShareProvider');
244
-			} catch (\OCP\AppFramework\QueryException $e) {
245
-				return null;
246
-			}
247
-		}
248
-
249
-		return $this->roomShareProvider;
250
-	}
251
-
252
-	/**
253
-	 * @inheritdoc
254
-	 */
255
-	public function getProvider($id) {
256
-		$provider = null;
257
-		if ($id === 'ocinternal') {
258
-			$provider = $this->defaultShareProvider();
259
-		} elseif ($id === 'ocFederatedSharing') {
260
-			$provider = $this->federatedShareProvider();
261
-		} elseif ($id === 'ocMailShare') {
262
-			$provider = $this->getShareByMailProvider();
263
-		} elseif ($id === 'ocCircleShare') {
264
-			$provider = $this->getShareByCircleProvider();
265
-		} elseif ($id === 'ocRoomShare') {
266
-			$provider = $this->getRoomShareProvider();
267
-		}
268
-
269
-		if ($provider === null) {
270
-			throw new ProviderException('No provider with id .' . $id . ' found.');
271
-		}
272
-
273
-		return $provider;
274
-	}
275
-
276
-	/**
277
-	 * @inheritdoc
278
-	 */
279
-	public function getProviderForType($shareType) {
280
-		$provider = null;
281
-
282
-		if ($shareType === IShare::TYPE_USER ||
283
-			$shareType === IShare::TYPE_GROUP ||
284
-			$shareType === IShare::TYPE_LINK
285
-		) {
286
-			$provider = $this->defaultShareProvider();
287
-		} elseif ($shareType === IShare::TYPE_REMOTE || $shareType === IShare::TYPE_REMOTE_GROUP) {
288
-			$provider = $this->federatedShareProvider();
289
-		} elseif ($shareType === IShare::TYPE_EMAIL) {
290
-			$provider = $this->getShareByMailProvider();
291
-		} elseif ($shareType === IShare::TYPE_CIRCLE) {
292
-			$provider = $this->getShareByCircleProvider();
293
-		} elseif ($shareType === IShare::TYPE_ROOM) {
294
-			$provider = $this->getRoomShareProvider();
295
-		}
296
-
297
-
298
-		if ($provider === null) {
299
-			throw new ProviderException('No share provider for share type ' . $shareType);
300
-		}
301
-
302
-		return $provider;
303
-	}
304
-
305
-	public function getAllProviders() {
306
-		$shares = [$this->defaultShareProvider(), $this->federatedShareProvider()];
307
-		$shareByMail = $this->getShareByMailProvider();
308
-		if ($shareByMail !== null) {
309
-			$shares[] = $shareByMail;
310
-		}
311
-		$shareByCircle = $this->getShareByCircleProvider();
312
-		if ($shareByCircle !== null) {
313
-			$shares[] = $shareByCircle;
314
-		}
315
-		$roomShare = $this->getRoomShareProvider();
316
-		if ($roomShare !== null) {
317
-			$shares[] = $roomShare;
318
-		}
319
-
320
-		return $shares;
321
-	}
237
+            $appManager = $this->serverContainer->getAppManager();
238
+            if (!$appManager->isEnabledForUser('spreed')) {
239
+                return null;
240
+            }
241
+
242
+            try {
243
+                $this->roomShareProvider = $this->serverContainer->query('\OCA\Talk\Share\RoomShareProvider');
244
+            } catch (\OCP\AppFramework\QueryException $e) {
245
+                return null;
246
+            }
247
+        }
248
+
249
+        return $this->roomShareProvider;
250
+    }
251
+
252
+    /**
253
+     * @inheritdoc
254
+     */
255
+    public function getProvider($id) {
256
+        $provider = null;
257
+        if ($id === 'ocinternal') {
258
+            $provider = $this->defaultShareProvider();
259
+        } elseif ($id === 'ocFederatedSharing') {
260
+            $provider = $this->federatedShareProvider();
261
+        } elseif ($id === 'ocMailShare') {
262
+            $provider = $this->getShareByMailProvider();
263
+        } elseif ($id === 'ocCircleShare') {
264
+            $provider = $this->getShareByCircleProvider();
265
+        } elseif ($id === 'ocRoomShare') {
266
+            $provider = $this->getRoomShareProvider();
267
+        }
268
+
269
+        if ($provider === null) {
270
+            throw new ProviderException('No provider with id .' . $id . ' found.');
271
+        }
272
+
273
+        return $provider;
274
+    }
275
+
276
+    /**
277
+     * @inheritdoc
278
+     */
279
+    public function getProviderForType($shareType) {
280
+        $provider = null;
281
+
282
+        if ($shareType === IShare::TYPE_USER ||
283
+            $shareType === IShare::TYPE_GROUP ||
284
+            $shareType === IShare::TYPE_LINK
285
+        ) {
286
+            $provider = $this->defaultShareProvider();
287
+        } elseif ($shareType === IShare::TYPE_REMOTE || $shareType === IShare::TYPE_REMOTE_GROUP) {
288
+            $provider = $this->federatedShareProvider();
289
+        } elseif ($shareType === IShare::TYPE_EMAIL) {
290
+            $provider = $this->getShareByMailProvider();
291
+        } elseif ($shareType === IShare::TYPE_CIRCLE) {
292
+            $provider = $this->getShareByCircleProvider();
293
+        } elseif ($shareType === IShare::TYPE_ROOM) {
294
+            $provider = $this->getRoomShareProvider();
295
+        }
296
+
297
+
298
+        if ($provider === null) {
299
+            throw new ProviderException('No share provider for share type ' . $shareType);
300
+        }
301
+
302
+        return $provider;
303
+    }
304
+
305
+    public function getAllProviders() {
306
+        $shares = [$this->defaultShareProvider(), $this->federatedShareProvider()];
307
+        $shareByMail = $this->getShareByMailProvider();
308
+        if ($shareByMail !== null) {
309
+            $shares[] = $shareByMail;
310
+        }
311
+        $shareByCircle = $this->getShareByCircleProvider();
312
+        if ($shareByCircle !== null) {
313
+            $shares[] = $shareByCircle;
314
+        }
315
+        $roomShare = $this->getRoomShareProvider();
316
+        if ($roomShare !== null) {
317
+            $shares[] = $roomShare;
318
+        }
319
+
320
+        return $shares;
321
+    }
322 322
 }
Please login to merge, or discard this patch.
apps/files_trashbin/appinfo/app.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 // register hooks
29 29
 \OCA\Files_Trashbin\Trashbin::registerHooks();
30 30
 
31
-\OCA\Files\App::getNavigationManager()->add(function () {
31
+\OCA\Files\App::getNavigationManager()->add(function() {
32 32
 	$l = \OC::$server->getL10N('files_trashbin');
33 33
 	return [
34 34
 		'id' => 'trashbin',
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,13 +29,13 @@
 block discarded – undo
29 29
 \OCA\Files_Trashbin\Trashbin::registerHooks();
30 30
 
31 31
 \OCA\Files\App::getNavigationManager()->add(function () {
32
-	$l = \OC::$server->getL10N('files_trashbin');
33
-	return [
34
-		'id' => 'trashbin',
35
-		'appname' => 'files_trashbin',
36
-		'script' => 'list.php',
37
-		'order' => 50,
38
-		'name' => $l->t('Deleted files'),
39
-		'classes' => 'pinned',
40
-	];
32
+    $l = \OC::$server->getL10N('files_trashbin');
33
+    return [
34
+        'id' => 'trashbin',
35
+        'appname' => 'files_trashbin',
36
+        'script' => 'list.php',
37
+        'order' => 50,
38
+        'name' => $l->t('Deleted files'),
39
+        'classes' => 'pinned',
40
+    ];
41 41
 });
Please login to merge, or discard this patch.
apps/dav/lib/CardDAV/Converter.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,9 +119,9 @@
 block discarded – undo
119 119
 		$elements = explode(' ', $fullName);
120 120
 		$result = ['', '', '', '', ''];
121 121
 		if (count($elements) > 2) {
122
-			$result[0] = implode(' ', array_slice($elements, count($elements)-1));
122
+			$result[0] = implode(' ', array_slice($elements, count($elements) - 1));
123 123
 			$result[1] = $elements[0];
124
-			$result[2] = implode(' ', array_slice($elements, 1, count($elements)-2));
124
+			$result[2] = implode(' ', array_slice($elements, 1, count($elements) - 2));
125 125
 		} elseif (count($elements) === 2) {
126 126
 			$result[0] = $elements[1];
127 127
 			$result[1] = $elements[0];
Please login to merge, or discard this patch.
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -33,119 +33,119 @@
 block discarded – undo
33 33
 
34 34
 class Converter {
35 35
 
36
-	/** @var AccountManager */
37
-	private $accountManager;
38
-
39
-	/**
40
-	 * Converter constructor.
41
-	 *
42
-	 * @param AccountManager $accountManager
43
-	 */
44
-	public function __construct(AccountManager $accountManager) {
45
-		$this->accountManager = $accountManager;
46
-	}
47
-
48
-	/**
49
-	 * @param IUser $user
50
-	 * @return VCard|null
51
-	 */
52
-	public function createCardFromUser(IUser $user) {
53
-		$userData = $this->accountManager->getUser($user);
54
-
55
-		$uid = $user->getUID();
56
-		$cloudId = $user->getCloudId();
57
-		$image = $this->getAvatarImage($user);
58
-
59
-		$vCard = new VCard();
60
-		$vCard->VERSION = '3.0';
61
-		$vCard->UID = $uid;
62
-
63
-		$publish = false;
64
-
65
-		if ($image !== null && isset($userData[AccountManager::PROPERTY_AVATAR])) {
66
-			$userData[AccountManager::PROPERTY_AVATAR]['value'] = true;
67
-		}
68
-
69
-		foreach ($userData as $property => $value) {
70
-			$shareWithTrustedServers =
71
-				$value['scope'] === AccountManager::VISIBILITY_CONTACTS_ONLY ||
72
-				$value['scope'] === AccountManager::VISIBILITY_PUBLIC;
73
-
74
-			$emptyValue = !isset($value['value']) || $value['value'] === '';
75
-
76
-			if ($shareWithTrustedServers && !$emptyValue) {
77
-				$publish = true;
78
-				switch ($property) {
79
-					case AccountManager::PROPERTY_DISPLAYNAME:
80
-						$vCard->add(new Text($vCard, 'FN', $value['value']));
81
-						$vCard->add(new Text($vCard, 'N', $this->splitFullName($value['value'])));
82
-						break;
83
-					case AccountManager::PROPERTY_AVATAR:
84
-						if ($image !== null) {
85
-							$vCard->add('PHOTO', $image->data(), ['ENCODING' => 'b', 'TYPE' => $image->mimeType()]);
86
-						}
87
-						break;
88
-					case AccountManager::PROPERTY_EMAIL:
89
-						$vCard->add(new Text($vCard, 'EMAIL', $value['value'], ['TYPE' => 'OTHER']));
90
-						break;
91
-					case AccountManager::PROPERTY_WEBSITE:
92
-						$vCard->add(new Text($vCard, 'URL', $value['value']));
93
-						break;
94
-					case AccountManager::PROPERTY_PHONE:
95
-						$vCard->add(new Text($vCard, 'TEL', $value['value'], ['TYPE' => 'OTHER']));
96
-						break;
97
-					case AccountManager::PROPERTY_ADDRESS:
98
-						$vCard->add(new Text($vCard, 'ADR', $value['value'], ['TYPE' => 'OTHER']));
99
-						break;
100
-					case AccountManager::PROPERTY_TWITTER:
101
-						$vCard->add(new Text($vCard, 'X-SOCIALPROFILE', $value['value'], ['TYPE' => 'TWITTER']));
102
-						break;
103
-				}
104
-			}
105
-		}
106
-
107
-		if ($publish && !empty($cloudId)) {
108
-			$vCard->add(new Text($vCard, 'CLOUD', $cloudId));
109
-			$vCard->validate();
110
-			return $vCard;
111
-		}
112
-
113
-		return null;
114
-	}
115
-
116
-	/**
117
-	 * @param string $fullName
118
-	 * @return string[]
119
-	 */
120
-	public function splitFullName($fullName) {
121
-		// Very basic western style parsing. I'm not gonna implement
122
-		// https://github.com/android/platform_packages_providers_contactsprovider/blob/master/src/com/android/providers/contacts/NameSplitter.java ;)
123
-
124
-		$elements = explode(' ', $fullName);
125
-		$result = ['', '', '', '', ''];
126
-		if (count($elements) > 2) {
127
-			$result[0] = implode(' ', array_slice($elements, count($elements)-1));
128
-			$result[1] = $elements[0];
129
-			$result[2] = implode(' ', array_slice($elements, 1, count($elements)-2));
130
-		} elseif (count($elements) === 2) {
131
-			$result[0] = $elements[1];
132
-			$result[1] = $elements[0];
133
-		} else {
134
-			$result[0] = $elements[0];
135
-		}
136
-
137
-		return $result;
138
-	}
139
-
140
-	/**
141
-	 * @param IUser $user
142
-	 * @return null|IImage
143
-	 */
144
-	private function getAvatarImage(IUser $user) {
145
-		try {
146
-			return $user->getAvatarImage(-1);
147
-		} catch (\Exception $ex) {
148
-			return null;
149
-		}
150
-	}
36
+    /** @var AccountManager */
37
+    private $accountManager;
38
+
39
+    /**
40
+     * Converter constructor.
41
+     *
42
+     * @param AccountManager $accountManager
43
+     */
44
+    public function __construct(AccountManager $accountManager) {
45
+        $this->accountManager = $accountManager;
46
+    }
47
+
48
+    /**
49
+     * @param IUser $user
50
+     * @return VCard|null
51
+     */
52
+    public function createCardFromUser(IUser $user) {
53
+        $userData = $this->accountManager->getUser($user);
54
+
55
+        $uid = $user->getUID();
56
+        $cloudId = $user->getCloudId();
57
+        $image = $this->getAvatarImage($user);
58
+
59
+        $vCard = new VCard();
60
+        $vCard->VERSION = '3.0';
61
+        $vCard->UID = $uid;
62
+
63
+        $publish = false;
64
+
65
+        if ($image !== null && isset($userData[AccountManager::PROPERTY_AVATAR])) {
66
+            $userData[AccountManager::PROPERTY_AVATAR]['value'] = true;
67
+        }
68
+
69
+        foreach ($userData as $property => $value) {
70
+            $shareWithTrustedServers =
71
+                $value['scope'] === AccountManager::VISIBILITY_CONTACTS_ONLY ||
72
+                $value['scope'] === AccountManager::VISIBILITY_PUBLIC;
73
+
74
+            $emptyValue = !isset($value['value']) || $value['value'] === '';
75
+
76
+            if ($shareWithTrustedServers && !$emptyValue) {
77
+                $publish = true;
78
+                switch ($property) {
79
+                    case AccountManager::PROPERTY_DISPLAYNAME:
80
+                        $vCard->add(new Text($vCard, 'FN', $value['value']));
81
+                        $vCard->add(new Text($vCard, 'N', $this->splitFullName($value['value'])));
82
+                        break;
83
+                    case AccountManager::PROPERTY_AVATAR:
84
+                        if ($image !== null) {
85
+                            $vCard->add('PHOTO', $image->data(), ['ENCODING' => 'b', 'TYPE' => $image->mimeType()]);
86
+                        }
87
+                        break;
88
+                    case AccountManager::PROPERTY_EMAIL:
89
+                        $vCard->add(new Text($vCard, 'EMAIL', $value['value'], ['TYPE' => 'OTHER']));
90
+                        break;
91
+                    case AccountManager::PROPERTY_WEBSITE:
92
+                        $vCard->add(new Text($vCard, 'URL', $value['value']));
93
+                        break;
94
+                    case AccountManager::PROPERTY_PHONE:
95
+                        $vCard->add(new Text($vCard, 'TEL', $value['value'], ['TYPE' => 'OTHER']));
96
+                        break;
97
+                    case AccountManager::PROPERTY_ADDRESS:
98
+                        $vCard->add(new Text($vCard, 'ADR', $value['value'], ['TYPE' => 'OTHER']));
99
+                        break;
100
+                    case AccountManager::PROPERTY_TWITTER:
101
+                        $vCard->add(new Text($vCard, 'X-SOCIALPROFILE', $value['value'], ['TYPE' => 'TWITTER']));
102
+                        break;
103
+                }
104
+            }
105
+        }
106
+
107
+        if ($publish && !empty($cloudId)) {
108
+            $vCard->add(new Text($vCard, 'CLOUD', $cloudId));
109
+            $vCard->validate();
110
+            return $vCard;
111
+        }
112
+
113
+        return null;
114
+    }
115
+
116
+    /**
117
+     * @param string $fullName
118
+     * @return string[]
119
+     */
120
+    public function splitFullName($fullName) {
121
+        // Very basic western style parsing. I'm not gonna implement
122
+        // https://github.com/android/platform_packages_providers_contactsprovider/blob/master/src/com/android/providers/contacts/NameSplitter.java ;)
123
+
124
+        $elements = explode(' ', $fullName);
125
+        $result = ['', '', '', '', ''];
126
+        if (count($elements) > 2) {
127
+            $result[0] = implode(' ', array_slice($elements, count($elements)-1));
128
+            $result[1] = $elements[0];
129
+            $result[2] = implode(' ', array_slice($elements, 1, count($elements)-2));
130
+        } elseif (count($elements) === 2) {
131
+            $result[0] = $elements[1];
132
+            $result[1] = $elements[0];
133
+        } else {
134
+            $result[0] = $elements[0];
135
+        }
136
+
137
+        return $result;
138
+    }
139
+
140
+    /**
141
+     * @param IUser $user
142
+     * @return null|IImage
143
+     */
144
+    private function getAvatarImage(IUser $user) {
145
+        try {
146
+            return $user->getAvatarImage(-1);
147
+        } catch (\Exception $ex) {
148
+            return null;
149
+        }
150
+    }
151 151
 }
Please login to merge, or discard this patch.
lib/private/Migration/ConsoleOutput.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -37,57 +37,57 @@
 block discarded – undo
37 37
  */
38 38
 class ConsoleOutput implements IOutput {
39 39
 
40
-	/** @var OutputInterface */
41
-	private $output;
40
+    /** @var OutputInterface */
41
+    private $output;
42 42
 
43
-	/** @var ProgressBar */
44
-	private $progressBar;
43
+    /** @var ProgressBar */
44
+    private $progressBar;
45 45
 
46
-	public function __construct(OutputInterface $output) {
47
-		$this->output = $output;
48
-	}
46
+    public function __construct(OutputInterface $output) {
47
+        $this->output = $output;
48
+    }
49 49
 
50
-	/**
51
-	 * @param string $message
52
-	 */
53
-	public function info($message) {
54
-		$this->output->writeln("<info>$message</info>");
55
-	}
50
+    /**
51
+     * @param string $message
52
+     */
53
+    public function info($message) {
54
+        $this->output->writeln("<info>$message</info>");
55
+    }
56 56
 
57
-	/**
58
-	 * @param string $message
59
-	 */
60
-	public function warning($message) {
61
-		$this->output->writeln("<comment>$message</comment>");
62
-	}
57
+    /**
58
+     * @param string $message
59
+     */
60
+    public function warning($message) {
61
+        $this->output->writeln("<comment>$message</comment>");
62
+    }
63 63
 
64
-	/**
65
-	 * @param int $max
66
-	 */
67
-	public function startProgress($max = 0) {
68
-		if (!is_null($this->progressBar)) {
69
-			$this->progressBar->finish();
70
-		}
71
-		$this->progressBar = new ProgressBar($this->output);
72
-		$this->progressBar->start($max);
73
-	}
64
+    /**
65
+     * @param int $max
66
+     */
67
+    public function startProgress($max = 0) {
68
+        if (!is_null($this->progressBar)) {
69
+            $this->progressBar->finish();
70
+        }
71
+        $this->progressBar = new ProgressBar($this->output);
72
+        $this->progressBar->start($max);
73
+    }
74 74
 
75
-	/**
76
-	 * @param int $step
77
-	 * @param string $description
78
-	 */
79
-	public function advance($step = 1, $description = '') {
80
-		if (!is_null($this->progressBar)) {
81
-			$this->progressBar = new ProgressBar($this->output);
82
-			$this->progressBar->start();
83
-		}
84
-		$this->progressBar->advance($step);
85
-	}
75
+    /**
76
+     * @param int $step
77
+     * @param string $description
78
+     */
79
+    public function advance($step = 1, $description = '') {
80
+        if (!is_null($this->progressBar)) {
81
+            $this->progressBar = new ProgressBar($this->output);
82
+            $this->progressBar->start();
83
+        }
84
+        $this->progressBar->advance($step);
85
+    }
86 86
 
87
-	public function finishProgress() {
88
-		if (is_null($this->progressBar)) {
89
-			return;
90
-		}
91
-		$this->progressBar->finish();
92
-	}
87
+    public function finishProgress() {
88
+        if (is_null($this->progressBar)) {
89
+            return;
90
+        }
91
+        $this->progressBar->finish();
92
+    }
93 93
 }
Please login to merge, or discard this patch.
lib/public/Contacts/ContactsMenu/IEntry.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
 interface IEntry extends JsonSerializable {
33 33
 
34
-	/**
35
-	 * @since 12.0
36
-	 * @return string
37
-	 */
38
-	public function getFullName();
34
+    /**
35
+     * @since 12.0
36
+     * @return string
37
+     */
38
+    public function getFullName();
39 39
 
40
-	/**
41
-	 * @since 12.0
42
-	 * @return string[]
43
-	 */
44
-	public function getEMailAddresses();
40
+    /**
41
+     * @since 12.0
42
+     * @return string[]
43
+     */
44
+    public function getEMailAddresses();
45 45
 
46
-	/**
47
-	 * @since 12.0
48
-	 * @return string|null image URI
49
-	 */
50
-	public function getAvatar();
46
+    /**
47
+     * @since 12.0
48
+     * @return string|null image URI
49
+     */
50
+    public function getAvatar();
51 51
 
52
-	/**
53
-	 * @since 12.0
54
-	 * @param IAction $action an action to show in the contacts menu
55
-	 */
56
-	public function addAction(IAction $action);
52
+    /**
53
+     * @since 12.0
54
+     * @param IAction $action an action to show in the contacts menu
55
+     */
56
+    public function addAction(IAction $action);
57 57
 
58
-	/**
59
-	 * Get an arbitrary property from the contact
60
-	 *
61
-	 * @since 12.0
62
-	 * @param string $key
63
-	 * @return mixed the value of the property or null
64
-	 */
65
-	public function getProperty($key);
58
+    /**
59
+     * Get an arbitrary property from the contact
60
+     *
61
+     * @since 12.0
62
+     * @param string $key
63
+     * @return mixed the value of the property or null
64
+     */
65
+    public function getProperty($key);
66 66
 }
Please login to merge, or discard this patch.
lib/private/Files/FileInfo.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @param \OCP\Files\Mount\IMountPoint $mount
88 88
 	 * @param \OCP\IUser|null $owner
89 89
 	 */
90
-	public function __construct($path, $storage, $internalPath, $data, $mount, $owner= null) {
90
+	public function __construct($path, $storage, $internalPath, $data, $mount, $owner = null) {
91 91
 		$this->path = $path;
92 92
 		$this->storage = $storage;
93 93
 		$this->internalPath = $internalPath;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @return int|null
154 154
 	 */
155 155
 	public function getId() {
156
-		return isset($this->data['fileid']) ? (int)  $this->data['fileid'] : null;
156
+		return isset($this->data['fileid']) ? (int) $this->data['fileid'] : null;
157 157
 	}
158 158
 
159 159
 	/**
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	public function getEtag() {
184 184
 		$this->updateEntryfromSubMounts();
185 185
 		if (count($this->childEtags) > 0) {
186
-			$combinedEtag = $this->data['etag'] . '::' . implode('::', $this->childEtags);
186
+			$combinedEtag = $this->data['etag'].'::'.implode('::', $this->childEtags);
187 187
 			return md5($combinedEtag);
188 188
 		} else {
189 189
 			return $this->data['etag'];
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 			$relativeEntryPath = substr($entryPath, strlen($this->getPath()));
380 380
 			// attach the permissions to propagate etag on permision changes of submounts
381 381
 			$permissions = isset($data['permissions']) ? $data['permissions'] : 0;
382
-			$this->childEtags[] = $relativeEntryPath . '/' . $data['etag'] . $permissions;
382
+			$this->childEtags[] = $relativeEntryPath.'/'.$data['etag'].$permissions;
383 383
 		}
384 384
 	}
385 385
 
Please login to merge, or discard this patch.
Indentation   +376 added lines, -376 removed lines patch added patch discarded remove patch
@@ -37,380 +37,380 @@
 block discarded – undo
37 37
 use OCP\IUser;
38 38
 
39 39
 class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
40
-	/**
41
-	 * @var array $data
42
-	 */
43
-	private $data;
44
-
45
-	/**
46
-	 * @var string $path
47
-	 */
48
-	private $path;
49
-
50
-	/**
51
-	 * @var \OC\Files\Storage\Storage $storage
52
-	 */
53
-	private $storage;
54
-
55
-	/**
56
-	 * @var string $internalPath
57
-	 */
58
-	private $internalPath;
59
-
60
-	/**
61
-	 * @var \OCP\Files\Mount\IMountPoint
62
-	 */
63
-	private $mount;
64
-
65
-	/**
66
-	 * @var IUser
67
-	 */
68
-	private $owner;
69
-
70
-	/**
71
-	 * @var string[]
72
-	 */
73
-	private $childEtags = [];
74
-
75
-	/**
76
-	 * @var IMountPoint[]
77
-	 */
78
-	private $subMounts = [];
79
-
80
-	private $subMountsUsed = false;
81
-
82
-	/**
83
-	 * The size of the file/folder without any sub mount
84
-	 *
85
-	 * @var int
86
-	 */
87
-	private $rawSize = 0;
88
-
89
-	/**
90
-	 * @param string|boolean $path
91
-	 * @param Storage\Storage $storage
92
-	 * @param string $internalPath
93
-	 * @param array|ICacheEntry $data
94
-	 * @param \OCP\Files\Mount\IMountPoint $mount
95
-	 * @param \OCP\IUser|null $owner
96
-	 */
97
-	public function __construct($path, $storage, $internalPath, $data, $mount, $owner= null) {
98
-		$this->path = $path;
99
-		$this->storage = $storage;
100
-		$this->internalPath = $internalPath;
101
-		$this->data = $data;
102
-		$this->mount = $mount;
103
-		$this->owner = $owner;
104
-		$this->rawSize = $this->data['size'] ?? 0;
105
-	}
106
-
107
-	public function offsetSet($offset, $value) {
108
-		$this->data[$offset] = $value;
109
-	}
110
-
111
-	public function offsetExists($offset) {
112
-		return isset($this->data[$offset]);
113
-	}
114
-
115
-	public function offsetUnset($offset) {
116
-		unset($this->data[$offset]);
117
-	}
118
-
119
-	public function offsetGet($offset) {
120
-		if ($offset === 'type') {
121
-			return $this->getType();
122
-		} elseif ($offset === 'etag') {
123
-			return $this->getEtag();
124
-		} elseif ($offset === 'size') {
125
-			return $this->getSize();
126
-		} elseif ($offset === 'mtime') {
127
-			return $this->getMTime();
128
-		} elseif ($offset === 'permissions') {
129
-			return $this->getPermissions();
130
-		} elseif (isset($this->data[$offset])) {
131
-			return $this->data[$offset];
132
-		} else {
133
-			return null;
134
-		}
135
-	}
136
-
137
-	/**
138
-	 * @return string
139
-	 */
140
-	public function getPath() {
141
-		return $this->path;
142
-	}
143
-
144
-	/**
145
-	 * @return \OCP\Files\Storage
146
-	 */
147
-	public function getStorage() {
148
-		return $this->storage;
149
-	}
150
-
151
-	/**
152
-	 * @return string
153
-	 */
154
-	public function getInternalPath() {
155
-		return $this->internalPath;
156
-	}
157
-
158
-	/**
159
-	 * Get FileInfo ID or null in case of part file
160
-	 *
161
-	 * @return int|null
162
-	 */
163
-	public function getId() {
164
-		return isset($this->data['fileid']) ? (int)  $this->data['fileid'] : null;
165
-	}
166
-
167
-	/**
168
-	 * @return string
169
-	 */
170
-	public function getMimetype() {
171
-		return $this->data['mimetype'];
172
-	}
173
-
174
-	/**
175
-	 * @return string
176
-	 */
177
-	public function getMimePart() {
178
-		return $this->data['mimepart'];
179
-	}
180
-
181
-	/**
182
-	 * @return string
183
-	 */
184
-	public function getName() {
185
-		return isset($this->data['name']) ? $this->data['name'] : basename($this->getPath());
186
-	}
187
-
188
-	/**
189
-	 * @return string
190
-	 */
191
-	public function getEtag() {
192
-		$this->updateEntryfromSubMounts();
193
-		if (count($this->childEtags) > 0) {
194
-			$combinedEtag = $this->data['etag'] . '::' . implode('::', $this->childEtags);
195
-			return md5($combinedEtag);
196
-		} else {
197
-			return $this->data['etag'];
198
-		}
199
-	}
200
-
201
-	/**
202
-	 * @return int
203
-	 */
204
-	public function getSize($includeMounts = true) {
205
-		if ($includeMounts) {
206
-			$this->updateEntryfromSubMounts();
207
-			return isset($this->data['size']) ? 0 + $this->data['size'] : 0;
208
-		} else {
209
-			return $this->rawSize;
210
-		}
211
-	}
212
-
213
-	/**
214
-	 * @return int
215
-	 */
216
-	public function getMTime() {
217
-		$this->updateEntryfromSubMounts();
218
-		return (int) $this->data['mtime'];
219
-	}
220
-
221
-	/**
222
-	 * @return bool
223
-	 */
224
-	public function isEncrypted() {
225
-		return $this->data['encrypted'];
226
-	}
227
-
228
-	/**
229
-	 * Return the currently version used for the HMAC in the encryption app
230
-	 *
231
-	 * @return int
232
-	 */
233
-	public function getEncryptedVersion() {
234
-		return isset($this->data['encryptedVersion']) ? (int) $this->data['encryptedVersion'] : 1;
235
-	}
236
-
237
-	/**
238
-	 * @return int
239
-	 */
240
-	public function getPermissions() {
241
-		$perms = (int) $this->data['permissions'];
242
-		if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) {
243
-			$perms = $perms & ~\OCP\Constants::PERMISSION_SHARE;
244
-		}
245
-		return (int) $perms;
246
-	}
247
-
248
-	/**
249
-	 * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
250
-	 */
251
-	public function getType() {
252
-		if (!isset($this->data['type'])) {
253
-			$this->data['type'] = ($this->getMimetype() === 'httpd/unix-directory') ? self::TYPE_FOLDER : self::TYPE_FILE;
254
-		}
255
-		return $this->data['type'];
256
-	}
257
-
258
-	public function getData() {
259
-		return $this->data;
260
-	}
261
-
262
-	/**
263
-	 * @param int $permissions
264
-	 * @return bool
265
-	 */
266
-	protected function checkPermissions($permissions) {
267
-		return ($this->getPermissions() & $permissions) === $permissions;
268
-	}
269
-
270
-	/**
271
-	 * @return bool
272
-	 */
273
-	public function isReadable() {
274
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_READ);
275
-	}
276
-
277
-	/**
278
-	 * @return bool
279
-	 */
280
-	public function isUpdateable() {
281
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE);
282
-	}
283
-
284
-	/**
285
-	 * Check whether new files or folders can be created inside this folder
286
-	 *
287
-	 * @return bool
288
-	 */
289
-	public function isCreatable() {
290
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_CREATE);
291
-	}
292
-
293
-	/**
294
-	 * @return bool
295
-	 */
296
-	public function isDeletable() {
297
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_DELETE);
298
-	}
299
-
300
-	/**
301
-	 * @return bool
302
-	 */
303
-	public function isShareable() {
304
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_SHARE);
305
-	}
306
-
307
-	/**
308
-	 * Check if a file or folder is shared
309
-	 *
310
-	 * @return bool
311
-	 */
312
-	public function isShared() {
313
-		$sid = $this->getStorage()->getId();
314
-		if (!is_null($sid)) {
315
-			$sid = explode(':', $sid);
316
-			return ($sid[0] === 'shared');
317
-		}
318
-
319
-		return false;
320
-	}
321
-
322
-	public function isMounted() {
323
-		$storage = $this->getStorage();
324
-		if ($storage->instanceOfStorage('\OCP\Files\IHomeStorage')) {
325
-			return false;
326
-		}
327
-		$sid = $storage->getId();
328
-		if (!is_null($sid)) {
329
-			$sid = explode(':', $sid);
330
-			return ($sid[0] !== 'home' and $sid[0] !== 'shared');
331
-		}
332
-
333
-		return false;
334
-	}
335
-
336
-	/**
337
-	 * Get the mountpoint the file belongs to
338
-	 *
339
-	 * @return \OCP\Files\Mount\IMountPoint
340
-	 */
341
-	public function getMountPoint() {
342
-		return $this->mount;
343
-	}
344
-
345
-	/**
346
-	 * Get the owner of the file
347
-	 *
348
-	 * @return \OCP\IUser
349
-	 */
350
-	public function getOwner() {
351
-		return $this->owner;
352
-	}
353
-
354
-	/**
355
-	 * @param IMountPoint[] $mounts
356
-	 */
357
-	public function setSubMounts(array $mounts) {
358
-		$this->subMounts = $mounts;
359
-	}
360
-
361
-	private function updateEntryfromSubMounts() {
362
-		if ($this->subMountsUsed) {
363
-			return;
364
-		}
365
-		$this->subMountsUsed = true;
366
-		foreach ($this->subMounts as $mount) {
367
-			$subStorage = $mount->getStorage();
368
-			if ($subStorage) {
369
-				$subCache = $subStorage->getCache('');
370
-				$rootEntry = $subCache->get('');
371
-				$this->addSubEntry($rootEntry, $mount->getMountPoint());
372
-			}
373
-		}
374
-	}
375
-
376
-	/**
377
-	 * Add a cache entry which is the child of this folder
378
-	 *
379
-	 * Sets the size, etag and size to for cross-storage childs
380
-	 *
381
-	 * @param array|ICacheEntry $data cache entry for the child
382
-	 * @param string $entryPath full path of the child entry
383
-	 */
384
-	public function addSubEntry($data, $entryPath) {
385
-		$this->data['size'] += isset($data['size']) ? $data['size'] : 0;
386
-		if (isset($data['mtime'])) {
387
-			$this->data['mtime'] = max($this->data['mtime'], $data['mtime']);
388
-		}
389
-		if (isset($data['etag'])) {
390
-			// prefix the etag with the relative path of the subentry to propagate etag on mount moves
391
-			$relativeEntryPath = substr($entryPath, strlen($this->getPath()));
392
-			// attach the permissions to propagate etag on permision changes of submounts
393
-			$permissions = isset($data['permissions']) ? $data['permissions'] : 0;
394
-			$this->childEtags[] = $relativeEntryPath . '/' . $data['etag'] . $permissions;
395
-		}
396
-	}
397
-
398
-	/**
399
-	 * @inheritdoc
400
-	 */
401
-	public function getChecksum() {
402
-		return $this->data['checksum'];
403
-	}
404
-
405
-	public function getExtension(): string {
406
-		return pathinfo($this->getName(), PATHINFO_EXTENSION);
407
-	}
408
-
409
-	public function getCreationTime(): int {
410
-		return (int) $this->data['creation_time'];
411
-	}
412
-
413
-	public function getUploadTime(): int {
414
-		return (int) $this->data['upload_time'];
415
-	}
40
+    /**
41
+     * @var array $data
42
+     */
43
+    private $data;
44
+
45
+    /**
46
+     * @var string $path
47
+     */
48
+    private $path;
49
+
50
+    /**
51
+     * @var \OC\Files\Storage\Storage $storage
52
+     */
53
+    private $storage;
54
+
55
+    /**
56
+     * @var string $internalPath
57
+     */
58
+    private $internalPath;
59
+
60
+    /**
61
+     * @var \OCP\Files\Mount\IMountPoint
62
+     */
63
+    private $mount;
64
+
65
+    /**
66
+     * @var IUser
67
+     */
68
+    private $owner;
69
+
70
+    /**
71
+     * @var string[]
72
+     */
73
+    private $childEtags = [];
74
+
75
+    /**
76
+     * @var IMountPoint[]
77
+     */
78
+    private $subMounts = [];
79
+
80
+    private $subMountsUsed = false;
81
+
82
+    /**
83
+     * The size of the file/folder without any sub mount
84
+     *
85
+     * @var int
86
+     */
87
+    private $rawSize = 0;
88
+
89
+    /**
90
+     * @param string|boolean $path
91
+     * @param Storage\Storage $storage
92
+     * @param string $internalPath
93
+     * @param array|ICacheEntry $data
94
+     * @param \OCP\Files\Mount\IMountPoint $mount
95
+     * @param \OCP\IUser|null $owner
96
+     */
97
+    public function __construct($path, $storage, $internalPath, $data, $mount, $owner= null) {
98
+        $this->path = $path;
99
+        $this->storage = $storage;
100
+        $this->internalPath = $internalPath;
101
+        $this->data = $data;
102
+        $this->mount = $mount;
103
+        $this->owner = $owner;
104
+        $this->rawSize = $this->data['size'] ?? 0;
105
+    }
106
+
107
+    public function offsetSet($offset, $value) {
108
+        $this->data[$offset] = $value;
109
+    }
110
+
111
+    public function offsetExists($offset) {
112
+        return isset($this->data[$offset]);
113
+    }
114
+
115
+    public function offsetUnset($offset) {
116
+        unset($this->data[$offset]);
117
+    }
118
+
119
+    public function offsetGet($offset) {
120
+        if ($offset === 'type') {
121
+            return $this->getType();
122
+        } elseif ($offset === 'etag') {
123
+            return $this->getEtag();
124
+        } elseif ($offset === 'size') {
125
+            return $this->getSize();
126
+        } elseif ($offset === 'mtime') {
127
+            return $this->getMTime();
128
+        } elseif ($offset === 'permissions') {
129
+            return $this->getPermissions();
130
+        } elseif (isset($this->data[$offset])) {
131
+            return $this->data[$offset];
132
+        } else {
133
+            return null;
134
+        }
135
+    }
136
+
137
+    /**
138
+     * @return string
139
+     */
140
+    public function getPath() {
141
+        return $this->path;
142
+    }
143
+
144
+    /**
145
+     * @return \OCP\Files\Storage
146
+     */
147
+    public function getStorage() {
148
+        return $this->storage;
149
+    }
150
+
151
+    /**
152
+     * @return string
153
+     */
154
+    public function getInternalPath() {
155
+        return $this->internalPath;
156
+    }
157
+
158
+    /**
159
+     * Get FileInfo ID or null in case of part file
160
+     *
161
+     * @return int|null
162
+     */
163
+    public function getId() {
164
+        return isset($this->data['fileid']) ? (int)  $this->data['fileid'] : null;
165
+    }
166
+
167
+    /**
168
+     * @return string
169
+     */
170
+    public function getMimetype() {
171
+        return $this->data['mimetype'];
172
+    }
173
+
174
+    /**
175
+     * @return string
176
+     */
177
+    public function getMimePart() {
178
+        return $this->data['mimepart'];
179
+    }
180
+
181
+    /**
182
+     * @return string
183
+     */
184
+    public function getName() {
185
+        return isset($this->data['name']) ? $this->data['name'] : basename($this->getPath());
186
+    }
187
+
188
+    /**
189
+     * @return string
190
+     */
191
+    public function getEtag() {
192
+        $this->updateEntryfromSubMounts();
193
+        if (count($this->childEtags) > 0) {
194
+            $combinedEtag = $this->data['etag'] . '::' . implode('::', $this->childEtags);
195
+            return md5($combinedEtag);
196
+        } else {
197
+            return $this->data['etag'];
198
+        }
199
+    }
200
+
201
+    /**
202
+     * @return int
203
+     */
204
+    public function getSize($includeMounts = true) {
205
+        if ($includeMounts) {
206
+            $this->updateEntryfromSubMounts();
207
+            return isset($this->data['size']) ? 0 + $this->data['size'] : 0;
208
+        } else {
209
+            return $this->rawSize;
210
+        }
211
+    }
212
+
213
+    /**
214
+     * @return int
215
+     */
216
+    public function getMTime() {
217
+        $this->updateEntryfromSubMounts();
218
+        return (int) $this->data['mtime'];
219
+    }
220
+
221
+    /**
222
+     * @return bool
223
+     */
224
+    public function isEncrypted() {
225
+        return $this->data['encrypted'];
226
+    }
227
+
228
+    /**
229
+     * Return the currently version used for the HMAC in the encryption app
230
+     *
231
+     * @return int
232
+     */
233
+    public function getEncryptedVersion() {
234
+        return isset($this->data['encryptedVersion']) ? (int) $this->data['encryptedVersion'] : 1;
235
+    }
236
+
237
+    /**
238
+     * @return int
239
+     */
240
+    public function getPermissions() {
241
+        $perms = (int) $this->data['permissions'];
242
+        if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) {
243
+            $perms = $perms & ~\OCP\Constants::PERMISSION_SHARE;
244
+        }
245
+        return (int) $perms;
246
+    }
247
+
248
+    /**
249
+     * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
250
+     */
251
+    public function getType() {
252
+        if (!isset($this->data['type'])) {
253
+            $this->data['type'] = ($this->getMimetype() === 'httpd/unix-directory') ? self::TYPE_FOLDER : self::TYPE_FILE;
254
+        }
255
+        return $this->data['type'];
256
+    }
257
+
258
+    public function getData() {
259
+        return $this->data;
260
+    }
261
+
262
+    /**
263
+     * @param int $permissions
264
+     * @return bool
265
+     */
266
+    protected function checkPermissions($permissions) {
267
+        return ($this->getPermissions() & $permissions) === $permissions;
268
+    }
269
+
270
+    /**
271
+     * @return bool
272
+     */
273
+    public function isReadable() {
274
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_READ);
275
+    }
276
+
277
+    /**
278
+     * @return bool
279
+     */
280
+    public function isUpdateable() {
281
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE);
282
+    }
283
+
284
+    /**
285
+     * Check whether new files or folders can be created inside this folder
286
+     *
287
+     * @return bool
288
+     */
289
+    public function isCreatable() {
290
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_CREATE);
291
+    }
292
+
293
+    /**
294
+     * @return bool
295
+     */
296
+    public function isDeletable() {
297
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_DELETE);
298
+    }
299
+
300
+    /**
301
+     * @return bool
302
+     */
303
+    public function isShareable() {
304
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_SHARE);
305
+    }
306
+
307
+    /**
308
+     * Check if a file or folder is shared
309
+     *
310
+     * @return bool
311
+     */
312
+    public function isShared() {
313
+        $sid = $this->getStorage()->getId();
314
+        if (!is_null($sid)) {
315
+            $sid = explode(':', $sid);
316
+            return ($sid[0] === 'shared');
317
+        }
318
+
319
+        return false;
320
+    }
321
+
322
+    public function isMounted() {
323
+        $storage = $this->getStorage();
324
+        if ($storage->instanceOfStorage('\OCP\Files\IHomeStorage')) {
325
+            return false;
326
+        }
327
+        $sid = $storage->getId();
328
+        if (!is_null($sid)) {
329
+            $sid = explode(':', $sid);
330
+            return ($sid[0] !== 'home' and $sid[0] !== 'shared');
331
+        }
332
+
333
+        return false;
334
+    }
335
+
336
+    /**
337
+     * Get the mountpoint the file belongs to
338
+     *
339
+     * @return \OCP\Files\Mount\IMountPoint
340
+     */
341
+    public function getMountPoint() {
342
+        return $this->mount;
343
+    }
344
+
345
+    /**
346
+     * Get the owner of the file
347
+     *
348
+     * @return \OCP\IUser
349
+     */
350
+    public function getOwner() {
351
+        return $this->owner;
352
+    }
353
+
354
+    /**
355
+     * @param IMountPoint[] $mounts
356
+     */
357
+    public function setSubMounts(array $mounts) {
358
+        $this->subMounts = $mounts;
359
+    }
360
+
361
+    private function updateEntryfromSubMounts() {
362
+        if ($this->subMountsUsed) {
363
+            return;
364
+        }
365
+        $this->subMountsUsed = true;
366
+        foreach ($this->subMounts as $mount) {
367
+            $subStorage = $mount->getStorage();
368
+            if ($subStorage) {
369
+                $subCache = $subStorage->getCache('');
370
+                $rootEntry = $subCache->get('');
371
+                $this->addSubEntry($rootEntry, $mount->getMountPoint());
372
+            }
373
+        }
374
+    }
375
+
376
+    /**
377
+     * Add a cache entry which is the child of this folder
378
+     *
379
+     * Sets the size, etag and size to for cross-storage childs
380
+     *
381
+     * @param array|ICacheEntry $data cache entry for the child
382
+     * @param string $entryPath full path of the child entry
383
+     */
384
+    public function addSubEntry($data, $entryPath) {
385
+        $this->data['size'] += isset($data['size']) ? $data['size'] : 0;
386
+        if (isset($data['mtime'])) {
387
+            $this->data['mtime'] = max($this->data['mtime'], $data['mtime']);
388
+        }
389
+        if (isset($data['etag'])) {
390
+            // prefix the etag with the relative path of the subentry to propagate etag on mount moves
391
+            $relativeEntryPath = substr($entryPath, strlen($this->getPath()));
392
+            // attach the permissions to propagate etag on permision changes of submounts
393
+            $permissions = isset($data['permissions']) ? $data['permissions'] : 0;
394
+            $this->childEtags[] = $relativeEntryPath . '/' . $data['etag'] . $permissions;
395
+        }
396
+    }
397
+
398
+    /**
399
+     * @inheritdoc
400
+     */
401
+    public function getChecksum() {
402
+        return $this->data['checksum'];
403
+    }
404
+
405
+    public function getExtension(): string {
406
+        return pathinfo($this->getName(), PATHINFO_EXTENSION);
407
+    }
408
+
409
+    public function getCreationTime(): int {
410
+        return (int) $this->data['creation_time'];
411
+    }
412
+
413
+    public function getUploadTime(): int {
414
+        return (int) $this->data['upload_time'];
415
+    }
416 416
 }
Please login to merge, or discard this patch.
apps/dav/lib/Avatars/RootCollection.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,23 +7,23 @@
 block discarded – undo
7 7
 
8 8
 class RootCollection extends AbstractPrincipalCollection {
9 9
 
10
-	/**
11
-	 * This method returns a node for a principal.
12
-	 *
13
-	 * The passed array contains principal information, and is guaranteed to
14
-	 * at least contain a uri item. Other properties may or may not be
15
-	 * supplied by the authentication backend.
16
-	 *
17
-	 * @param array $principalInfo
18
-	 * @return AvatarHome
19
-	 */
20
-	public function getChildForPrincipal(array $principalInfo) {
21
-		$avatarManager = \OC::$server->getAvatarManager();
22
-		return new AvatarHome($principalInfo, $avatarManager);
23
-	}
10
+    /**
11
+     * This method returns a node for a principal.
12
+     *
13
+     * The passed array contains principal information, and is guaranteed to
14
+     * at least contain a uri item. Other properties may or may not be
15
+     * supplied by the authentication backend.
16
+     *
17
+     * @param array $principalInfo
18
+     * @return AvatarHome
19
+     */
20
+    public function getChildForPrincipal(array $principalInfo) {
21
+        $avatarManager = \OC::$server->getAvatarManager();
22
+        return new AvatarHome($principalInfo, $avatarManager);
23
+    }
24 24
 
25
-	public function getName() {
26
-		return 'avatars';
27
-	}
25
+    public function getName() {
26
+        return 'avatars';
27
+    }
28 28
 
29 29
 }
Please login to merge, or discard this patch.