Passed
Push — master ( b37a49...348454 )
by Joas
15:41 queued 15s
created
apps/settings/lib/Controller/LogSettingsController.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -35,28 +35,28 @@
 block discarded – undo
35 35
 
36 36
 class LogSettingsController extends Controller {
37 37
 
38
-	/** @var Log */
39
-	private $log;
38
+    /** @var Log */
39
+    private $log;
40 40
 
41
-	public function __construct(string $appName, IRequest $request, Log $logger) {
42
-		parent::__construct($appName, $request);
43
-		$this->log = $logger;
44
-	}
41
+    public function __construct(string $appName, IRequest $request, Log $logger) {
42
+        parent::__construct($appName, $request);
43
+        $this->log = $logger;
44
+    }
45 45
 
46
-	/**
47
-	 * download logfile
48
-	 *
49
-	 * @NoCSRFRequired
50
-	 *
51
-	 * @return StreamResponse
52
-	 */
53
-	public function download() {
54
-		if (!$this->log instanceof Log) {
55
-			throw new \UnexpectedValueException('Log file not available');
56
-		}
57
-		$resp = new StreamResponse($this->log->getLogPath());
58
-		$resp->addHeader('Content-Type', 'application/octet-stream');
59
-		$resp->addHeader('Content-Disposition', 'attachment; filename="nextcloud.log"');
60
-		return $resp;
61
-	}
46
+    /**
47
+     * download logfile
48
+     *
49
+     * @NoCSRFRequired
50
+     *
51
+     * @return StreamResponse
52
+     */
53
+    public function download() {
54
+        if (!$this->log instanceof Log) {
55
+            throw new \UnexpectedValueException('Log file not available');
56
+        }
57
+        $resp = new StreamResponse($this->log->getLogPath());
58
+        $resp->addHeader('Content-Type', 'application/octet-stream');
59
+        $resp->addHeader('Content-Disposition', 'attachment; filename="nextcloud.log"');
60
+        return $resp;
61
+    }
62 62
 }
Please login to merge, or discard this patch.
apps/settings/templates/settings/admin/overview.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,9 +46,9 @@
 block discarded – undo
46 46
 	</div>
47 47
 
48 48
 	<div id="postsetupchecks" data-check-wellknown="<?php if ($_['checkForWorkingWellKnownSetup']) {
49
-	p('true');
49
+    p('true');
50 50
 } else {
51
-	p('false');
51
+    p('false');
52 52
 } ?>">
53 53
 		<ul class="errors hidden"></ul>
54 54
 		<ul class="warnings hidden"></ul>
Please login to merge, or discard this patch.
apps/settings/templates/settings/additional.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 ?>
28 28
 
29 29
 <?php foreach ($_['forms'] as $form) {
30
-	if (isset($form['form'])) {?>
30
+    if (isset($form['form'])) {?>
31 31
 		<div id="<?php isset($form['anchor']) ? p($form['anchor']) : p('');?>"><?php print_unescaped($form['form']);?></div>
32 32
 	<?php }
33 33
 } ?>
Please login to merge, or discard this patch.
apps/settings/templates/settings-vue.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 
27 27
 // Do we have some data to inject ?
28 28
 if (is_array($_['serverData'])) {
29
-	?>
29
+    ?>
30 30
 <span id="serverData" data-server="<?php p(json_encode($_['serverData'])); ?>"></span>
31 31
 <?php
32 32
 } ?>
Please login to merge, or discard this patch.
apps/files/lib/Settings/PersonalSettings.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,15 +31,15 @@
 block discarded – undo
31 31
 use OCP\Settings\ISettings;
32 32
 
33 33
 class PersonalSettings implements ISettings {
34
-	public function getForm(): TemplateResponse {
35
-		return new TemplateResponse(Application::APP_ID, 'settings-personal');
36
-	}
34
+    public function getForm(): TemplateResponse {
35
+        return new TemplateResponse(Application::APP_ID, 'settings-personal');
36
+    }
37 37
 
38
-	public function getSection(): string {
39
-		return 'sharing';
40
-	}
38
+    public function getSection(): string {
39
+        return 'sharing';
40
+    }
41 41
 
42
-	public function getPriority(): int {
43
-		return 90;
44
-	}
42
+    public function getPriority(): int {
43
+        return 90;
44
+    }
45 45
 }
Please login to merge, or discard this patch.
apps/files/lib/Collaboration/Resources/ResourceProvider.php 1 patch
Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -37,100 +37,100 @@
 block discarded – undo
37 37
 use OCP\IUser;
38 38
 
39 39
 class ResourceProvider implements IProvider {
40
-	public const RESOURCE_TYPE = 'file';
41
-
42
-	/** @var IRootFolder */
43
-	protected $rootFolder;
44
-	/** @var IPreview */
45
-	private $preview;
46
-	/** @var IURLGenerator */
47
-	private $urlGenerator;
48
-
49
-	/** @var array */
50
-	protected $nodes = [];
51
-
52
-	public function __construct(IRootFolder $rootFolder,
53
-								IPreview $preview,
54
-								IURLGenerator $urlGenerator) {
55
-		$this->rootFolder = $rootFolder;
56
-		$this->preview = $preview;
57
-		$this->urlGenerator = $urlGenerator;
58
-	}
59
-
60
-	private function getNode(IResource $resource): ?Node {
61
-		if (isset($this->nodes[(int) $resource->getId()])) {
62
-			return $this->nodes[(int) $resource->getId()];
63
-		}
64
-		$nodes = $this->rootFolder->getById((int) $resource->getId());
65
-		if (!empty($nodes)) {
66
-			$this->nodes[(int) $resource->getId()] = array_shift($nodes);
67
-			return $this->nodes[(int) $resource->getId()];
68
-		}
69
-		return null;
70
-	}
71
-
72
-	/**
73
-	 * @param IResource $resource
74
-	 * @return array
75
-	 * @since 16.0.0
76
-	 */
77
-	public function getResourceRichObject(IResource $resource): array {
78
-		if (isset($this->nodes[(int) $resource->getId()])) {
79
-			$node = $this->nodes[(int) $resource->getId()]->getPath();
80
-		} else {
81
-			$node = $this->getNode($resource);
82
-		}
83
-
84
-		if ($node instanceof Node) {
85
-			$link = $this->urlGenerator->linkToRouteAbsolute(
86
-				'files.viewcontroller.showFile',
87
-				['fileid' => $resource->getId()]
88
-			);
89
-			return [
90
-				'type' => 'file',
91
-				'id' => $resource->getId(),
92
-				'name' => $node->getName(),
93
-				'path' => $node->getInternalPath(),
94
-				'link' => $link,
95
-				'mimetype' => $node->getMimetype(),
96
-				'preview-available' => $this->preview->isAvailable($node),
97
-			];
98
-		}
99
-
100
-		throw new ResourceException('File not found');
101
-	}
102
-
103
-	/**
104
-	 * Can a user/guest access the collection
105
-	 *
106
-	 * @param IResource $resource
107
-	 * @param IUser $user
108
-	 * @return bool
109
-	 * @since 16.0.0
110
-	 */
111
-	public function canAccessResource(IResource $resource, IUser $user = null): bool {
112
-		if (!$user instanceof IUser) {
113
-			return false;
114
-		}
115
-
116
-		$userFolder = $this->rootFolder->getUserFolder($user->getUID());
117
-		$nodes = $userFolder->getById((int) $resource->getId());
118
-
119
-		if (!empty($nodes)) {
120
-			$this->nodes[(int) $resource->getId()] = array_shift($nodes);
121
-			return true;
122
-		}
123
-
124
-		return false;
125
-	}
126
-
127
-	/**
128
-	 * Get the resource type of the provider
129
-	 *
130
-	 * @return string
131
-	 * @since 16.0.0
132
-	 */
133
-	public function getType(): string {
134
-		return self::RESOURCE_TYPE;
135
-	}
40
+    public const RESOURCE_TYPE = 'file';
41
+
42
+    /** @var IRootFolder */
43
+    protected $rootFolder;
44
+    /** @var IPreview */
45
+    private $preview;
46
+    /** @var IURLGenerator */
47
+    private $urlGenerator;
48
+
49
+    /** @var array */
50
+    protected $nodes = [];
51
+
52
+    public function __construct(IRootFolder $rootFolder,
53
+                                IPreview $preview,
54
+                                IURLGenerator $urlGenerator) {
55
+        $this->rootFolder = $rootFolder;
56
+        $this->preview = $preview;
57
+        $this->urlGenerator = $urlGenerator;
58
+    }
59
+
60
+    private function getNode(IResource $resource): ?Node {
61
+        if (isset($this->nodes[(int) $resource->getId()])) {
62
+            return $this->nodes[(int) $resource->getId()];
63
+        }
64
+        $nodes = $this->rootFolder->getById((int) $resource->getId());
65
+        if (!empty($nodes)) {
66
+            $this->nodes[(int) $resource->getId()] = array_shift($nodes);
67
+            return $this->nodes[(int) $resource->getId()];
68
+        }
69
+        return null;
70
+    }
71
+
72
+    /**
73
+     * @param IResource $resource
74
+     * @return array
75
+     * @since 16.0.0
76
+     */
77
+    public function getResourceRichObject(IResource $resource): array {
78
+        if (isset($this->nodes[(int) $resource->getId()])) {
79
+            $node = $this->nodes[(int) $resource->getId()]->getPath();
80
+        } else {
81
+            $node = $this->getNode($resource);
82
+        }
83
+
84
+        if ($node instanceof Node) {
85
+            $link = $this->urlGenerator->linkToRouteAbsolute(
86
+                'files.viewcontroller.showFile',
87
+                ['fileid' => $resource->getId()]
88
+            );
89
+            return [
90
+                'type' => 'file',
91
+                'id' => $resource->getId(),
92
+                'name' => $node->getName(),
93
+                'path' => $node->getInternalPath(),
94
+                'link' => $link,
95
+                'mimetype' => $node->getMimetype(),
96
+                'preview-available' => $this->preview->isAvailable($node),
97
+            ];
98
+        }
99
+
100
+        throw new ResourceException('File not found');
101
+    }
102
+
103
+    /**
104
+     * Can a user/guest access the collection
105
+     *
106
+     * @param IResource $resource
107
+     * @param IUser $user
108
+     * @return bool
109
+     * @since 16.0.0
110
+     */
111
+    public function canAccessResource(IResource $resource, IUser $user = null): bool {
112
+        if (!$user instanceof IUser) {
113
+            return false;
114
+        }
115
+
116
+        $userFolder = $this->rootFolder->getUserFolder($user->getUID());
117
+        $nodes = $userFolder->getById((int) $resource->getId());
118
+
119
+        if (!empty($nodes)) {
120
+            $this->nodes[(int) $resource->getId()] = array_shift($nodes);
121
+            return true;
122
+        }
123
+
124
+        return false;
125
+    }
126
+
127
+    /**
128
+     * Get the resource type of the provider
129
+     *
130
+     * @return string
131
+     * @since 16.0.0
132
+     */
133
+    public function getType(): string {
134
+        return self::RESOURCE_TYPE;
135
+    }
136 136
 }
Please login to merge, or discard this patch.
apps/files/lib/Controller/AjaxController.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -33,26 +33,26 @@
 block discarded – undo
33 33
 use OCP\IRequest;
34 34
 
35 35
 class AjaxController extends Controller {
36
-	public function __construct(string $appName, IRequest $request) {
37
-		parent::__construct($appName, $request);
38
-	}
36
+    public function __construct(string $appName, IRequest $request) {
37
+        parent::__construct($appName, $request);
38
+    }
39 39
 
40
-	/**
41
-	 * @NoAdminRequired
42
-	 */
43
-	public function getStorageStats(string $dir = '/'): JSONResponse {
44
-		try {
45
-			return new JSONResponse([
46
-				'status' => 'success',
47
-				'data' => Helper::buildFileStorageStatistics($dir),
48
-			]);
49
-		} catch (NotFoundException $e) {
50
-			return new JSONResponse([
51
-				'status' => 'error',
52
-				'data' => [
53
-					'message' => 'Folder not found'
54
-				],
55
-			]);
56
-		}
57
-	}
40
+    /**
41
+     * @NoAdminRequired
42
+     */
43
+    public function getStorageStats(string $dir = '/'): JSONResponse {
44
+        try {
45
+            return new JSONResponse([
46
+                'status' => 'success',
47
+                'data' => Helper::buildFileStorageStatistics($dir),
48
+            ]);
49
+        } catch (NotFoundException $e) {
50
+            return new JSONResponse([
51
+                'status' => 'error',
52
+                'data' => [
53
+                    'message' => 'Folder not found'
54
+                ],
55
+            ]);
56
+        }
57
+    }
58 58
 }
Please login to merge, or discard this patch.
apps/files/lib/BackgroundJob/TransferOwnership.php 1 patch
Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -42,141 +42,141 @@
 block discarded – undo
42 42
 
43 43
 class TransferOwnership extends QueuedJob {
44 44
 
45
-	/** @var IUserManager $userManager */
46
-	private $userManager;
47
-
48
-	/** @var OwnershipTransferService */
49
-	private $transferService;
50
-
51
-	/** @var ILogger */
52
-	private $logger;
53
-
54
-	/** @var NotificationManager */
55
-	private $notificationManager;
56
-
57
-	/** @var TransferOwnershipMapper */
58
-	private $mapper;
59
-	/** @var IRootFolder */
60
-	private $rootFolder;
61
-
62
-	public function __construct(ITimeFactory $timeFactory,
63
-								IUserManager $userManager,
64
-								OwnershipTransferService $transferService,
65
-								ILogger $logger,
66
-								NotificationManager $notificationManager,
67
-								TransferOwnershipMapper $mapper,
68
-								IRootFolder $rootFolder) {
69
-		parent::__construct($timeFactory);
70
-
71
-		$this->userManager = $userManager;
72
-		$this->transferService = $transferService;
73
-		$this->logger = $logger;
74
-		$this->notificationManager = $notificationManager;
75
-		$this->mapper = $mapper;
76
-		$this->rootFolder = $rootFolder;
77
-	}
78
-
79
-	protected function run($argument) {
80
-		$id = $argument['id'];
81
-
82
-		$transfer = $this->mapper->getById($id);
83
-		$sourceUser = $transfer->getSourceUser();
84
-		$destinationUser = $transfer->getTargetUser();
85
-		$fileId = $transfer->getFileId();
86
-
87
-		$userFolder = $this->rootFolder->getUserFolder($sourceUser);
88
-		$nodes = $userFolder->getById($fileId);
89
-
90
-		if (empty($nodes)) {
91
-			$this->logger->alert('Could not transfer ownership: Node not found');
92
-			$this->failedNotication($transfer);
93
-			return;
94
-		}
95
-		$path = $userFolder->getRelativePath($nodes[0]->getPath());
96
-
97
-		$sourceUserObject = $this->userManager->get($sourceUser);
98
-		$destinationUserObject = $this->userManager->get($destinationUser);
99
-
100
-		if (!$sourceUserObject instanceof IUser) {
101
-			$this->logger->alert('Could not transfer ownership: Unknown source user ' . $sourceUser);
102
-			$this->failedNotication($transfer);
103
-			return;
104
-		}
105
-
106
-		if (!$destinationUserObject instanceof IUser) {
107
-			$this->logger->alert("Unknown destination user $destinationUser");
108
-			$this->failedNotication($transfer);
109
-			return;
110
-		}
111
-
112
-		try {
113
-			$this->transferService->transfer(
114
-				$sourceUserObject,
115
-				$destinationUserObject,
116
-				ltrim($path, '/')
117
-			);
118
-			$this->successNotification($transfer);
119
-		} catch (TransferOwnershipException $e) {
120
-			$this->logger->logException($e);
121
-			$this->failedNotication($transfer);
122
-		}
123
-
124
-		$this->mapper->delete($transfer);
125
-	}
126
-
127
-	private function failedNotication(Transfer $transfer): void {
128
-		// Send notification to source user
129
-		$notification = $this->notificationManager->createNotification();
130
-		$notification->setUser($transfer->getSourceUser())
131
-			->setApp(Application::APP_ID)
132
-			->setDateTime($this->time->getDateTime())
133
-			->setSubject('transferOwnershipFailedSource', [
134
-				'sourceUser' => $transfer->getSourceUser(),
135
-				'targetUser' => $transfer->getTargetUser(),
136
-				'nodeName' => $transfer->getNodeName(),
137
-			])
138
-			->setObject('transfer', (string)$transfer->getId());
139
-		$this->notificationManager->notify($notification);
140
-
141
-		// Send notification to source user
142
-		$notification = $this->notificationManager->createNotification();
143
-		$notification->setUser($transfer->getTargetUser())
144
-			->setApp(Application::APP_ID)
145
-			->setDateTime($this->time->getDateTime())
146
-			->setSubject('transferOwnershipFailedTarget', [
147
-				'sourceUser' => $transfer->getSourceUser(),
148
-				'targetUser' => $transfer->getTargetUser(),
149
-				'nodeName' => $transfer->getNodeName(),
150
-			])
151
-			->setObject('transfer', (string)$transfer->getId());
152
-		$this->notificationManager->notify($notification);
153
-	}
154
-
155
-	private function successNotification(Transfer $transfer): void {
156
-		// Send notification to source user
157
-		$notification = $this->notificationManager->createNotification();
158
-		$notification->setUser($transfer->getSourceUser())
159
-			->setApp(Application::APP_ID)
160
-			->setDateTime($this->time->getDateTime())
161
-			->setSubject('transferOwnershipDoneSource', [
162
-				'sourceUser' => $transfer->getSourceUser(),
163
-				'targetUser' => $transfer->getTargetUser(),
164
-				'nodeName' => $transfer->getNodeName(),
165
-			])
166
-			->setObject('transfer', (string)$transfer->getId());
167
-		$this->notificationManager->notify($notification);
168
-
169
-		// Send notification to source user
170
-		$notification = $this->notificationManager->createNotification();
171
-		$notification->setUser($transfer->getTargetUser())
172
-			->setApp(Application::APP_ID)
173
-			->setDateTime($this->time->getDateTime())
174
-			->setSubject('transferOwnershipDoneTarget', [
175
-				'sourceUser' => $transfer->getSourceUser(),
176
-				'targetUser' => $transfer->getTargetUser(),
177
-				'nodeName' => $transfer->getNodeName(),
178
-			])
179
-			->setObject('transfer', (string)$transfer->getId());
180
-		$this->notificationManager->notify($notification);
181
-	}
45
+    /** @var IUserManager $userManager */
46
+    private $userManager;
47
+
48
+    /** @var OwnershipTransferService */
49
+    private $transferService;
50
+
51
+    /** @var ILogger */
52
+    private $logger;
53
+
54
+    /** @var NotificationManager */
55
+    private $notificationManager;
56
+
57
+    /** @var TransferOwnershipMapper */
58
+    private $mapper;
59
+    /** @var IRootFolder */
60
+    private $rootFolder;
61
+
62
+    public function __construct(ITimeFactory $timeFactory,
63
+                                IUserManager $userManager,
64
+                                OwnershipTransferService $transferService,
65
+                                ILogger $logger,
66
+                                NotificationManager $notificationManager,
67
+                                TransferOwnershipMapper $mapper,
68
+                                IRootFolder $rootFolder) {
69
+        parent::__construct($timeFactory);
70
+
71
+        $this->userManager = $userManager;
72
+        $this->transferService = $transferService;
73
+        $this->logger = $logger;
74
+        $this->notificationManager = $notificationManager;
75
+        $this->mapper = $mapper;
76
+        $this->rootFolder = $rootFolder;
77
+    }
78
+
79
+    protected function run($argument) {
80
+        $id = $argument['id'];
81
+
82
+        $transfer = $this->mapper->getById($id);
83
+        $sourceUser = $transfer->getSourceUser();
84
+        $destinationUser = $transfer->getTargetUser();
85
+        $fileId = $transfer->getFileId();
86
+
87
+        $userFolder = $this->rootFolder->getUserFolder($sourceUser);
88
+        $nodes = $userFolder->getById($fileId);
89
+
90
+        if (empty($nodes)) {
91
+            $this->logger->alert('Could not transfer ownership: Node not found');
92
+            $this->failedNotication($transfer);
93
+            return;
94
+        }
95
+        $path = $userFolder->getRelativePath($nodes[0]->getPath());
96
+
97
+        $sourceUserObject = $this->userManager->get($sourceUser);
98
+        $destinationUserObject = $this->userManager->get($destinationUser);
99
+
100
+        if (!$sourceUserObject instanceof IUser) {
101
+            $this->logger->alert('Could not transfer ownership: Unknown source user ' . $sourceUser);
102
+            $this->failedNotication($transfer);
103
+            return;
104
+        }
105
+
106
+        if (!$destinationUserObject instanceof IUser) {
107
+            $this->logger->alert("Unknown destination user $destinationUser");
108
+            $this->failedNotication($transfer);
109
+            return;
110
+        }
111
+
112
+        try {
113
+            $this->transferService->transfer(
114
+                $sourceUserObject,
115
+                $destinationUserObject,
116
+                ltrim($path, '/')
117
+            );
118
+            $this->successNotification($transfer);
119
+        } catch (TransferOwnershipException $e) {
120
+            $this->logger->logException($e);
121
+            $this->failedNotication($transfer);
122
+        }
123
+
124
+        $this->mapper->delete($transfer);
125
+    }
126
+
127
+    private function failedNotication(Transfer $transfer): void {
128
+        // Send notification to source user
129
+        $notification = $this->notificationManager->createNotification();
130
+        $notification->setUser($transfer->getSourceUser())
131
+            ->setApp(Application::APP_ID)
132
+            ->setDateTime($this->time->getDateTime())
133
+            ->setSubject('transferOwnershipFailedSource', [
134
+                'sourceUser' => $transfer->getSourceUser(),
135
+                'targetUser' => $transfer->getTargetUser(),
136
+                'nodeName' => $transfer->getNodeName(),
137
+            ])
138
+            ->setObject('transfer', (string)$transfer->getId());
139
+        $this->notificationManager->notify($notification);
140
+
141
+        // Send notification to source user
142
+        $notification = $this->notificationManager->createNotification();
143
+        $notification->setUser($transfer->getTargetUser())
144
+            ->setApp(Application::APP_ID)
145
+            ->setDateTime($this->time->getDateTime())
146
+            ->setSubject('transferOwnershipFailedTarget', [
147
+                'sourceUser' => $transfer->getSourceUser(),
148
+                'targetUser' => $transfer->getTargetUser(),
149
+                'nodeName' => $transfer->getNodeName(),
150
+            ])
151
+            ->setObject('transfer', (string)$transfer->getId());
152
+        $this->notificationManager->notify($notification);
153
+    }
154
+
155
+    private function successNotification(Transfer $transfer): void {
156
+        // Send notification to source user
157
+        $notification = $this->notificationManager->createNotification();
158
+        $notification->setUser($transfer->getSourceUser())
159
+            ->setApp(Application::APP_ID)
160
+            ->setDateTime($this->time->getDateTime())
161
+            ->setSubject('transferOwnershipDoneSource', [
162
+                'sourceUser' => $transfer->getSourceUser(),
163
+                'targetUser' => $transfer->getTargetUser(),
164
+                'nodeName' => $transfer->getNodeName(),
165
+            ])
166
+            ->setObject('transfer', (string)$transfer->getId());
167
+        $this->notificationManager->notify($notification);
168
+
169
+        // Send notification to source user
170
+        $notification = $this->notificationManager->createNotification();
171
+        $notification->setUser($transfer->getTargetUser())
172
+            ->setApp(Application::APP_ID)
173
+            ->setDateTime($this->time->getDateTime())
174
+            ->setSubject('transferOwnershipDoneTarget', [
175
+                'sourceUser' => $transfer->getSourceUser(),
176
+                'targetUser' => $transfer->getTargetUser(),
177
+                'nodeName' => $transfer->getNodeName(),
178
+            ])
179
+            ->setObject('transfer', (string)$transfer->getId());
180
+        $this->notificationManager->notify($notification);
181
+    }
182 182
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Integration/ExternalCalendar.php 1 patch
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -33,99 +33,99 @@
 block discarded – undo
33 33
  */
34 34
 abstract class ExternalCalendar implements CalDAV\ICalendar, DAV\IProperties {
35 35
 
36
-	/** @var string */
37
-	private const PREFIX = 'app-generated';
36
+    /** @var string */
37
+    private const PREFIX = 'app-generated';
38 38
 
39
-	/**
40
-	 * @var string
41
-	 *
42
-	 * Double dash is a valid delimiter,
43
-	 * because it will always split the calendarURIs correctly:
44
-	 * - our prefix contains only one dash and won't be split
45
-	 * - appIds are not allowed to contain dashes as per spec:
46
-	 * > must contain only lowercase ASCII characters and underscore
47
-	 * - explode has a limit of three, so even if the app-generated
48
-	 *   calendar uri has double dashes, it won't be split
49
-	 */
50
-	private const DELIMITER = '--';
39
+    /**
40
+     * @var string
41
+     *
42
+     * Double dash is a valid delimiter,
43
+     * because it will always split the calendarURIs correctly:
44
+     * - our prefix contains only one dash and won't be split
45
+     * - appIds are not allowed to contain dashes as per spec:
46
+     * > must contain only lowercase ASCII characters and underscore
47
+     * - explode has a limit of three, so even if the app-generated
48
+     *   calendar uri has double dashes, it won't be split
49
+     */
50
+    private const DELIMITER = '--';
51 51
 
52
-	/** @var string */
53
-	private $appId;
52
+    /** @var string */
53
+    private $appId;
54 54
 
55
-	/** @var string */
56
-	private $calendarUri;
55
+    /** @var string */
56
+    private $calendarUri;
57 57
 
58
-	/**
59
-	 * ExternalCalendar constructor.
60
-	 *
61
-	 * @param string $appId
62
-	 * @param string $calendarUri
63
-	 */
64
-	public function __construct(string $appId, string $calendarUri) {
65
-		$this->appId = $appId;
66
-		$this->calendarUri = $calendarUri;
67
-	}
58
+    /**
59
+     * ExternalCalendar constructor.
60
+     *
61
+     * @param string $appId
62
+     * @param string $calendarUri
63
+     */
64
+    public function __construct(string $appId, string $calendarUri) {
65
+        $this->appId = $appId;
66
+        $this->calendarUri = $calendarUri;
67
+    }
68 68
 
69
-	/**
70
-	 * @inheritDoc
71
-	 */
72
-	final public function getName() {
73
-		return implode(self::DELIMITER, [
74
-			self::PREFIX,
75
-			$this->appId,
76
-			$this->calendarUri,
77
-		]);
78
-	}
69
+    /**
70
+     * @inheritDoc
71
+     */
72
+    final public function getName() {
73
+        return implode(self::DELIMITER, [
74
+            self::PREFIX,
75
+            $this->appId,
76
+            $this->calendarUri,
77
+        ]);
78
+    }
79 79
 
80
-	/**
81
-	 * @inheritDoc
82
-	 */
83
-	final public function setName($name) {
84
-		throw new DAV\Exception\MethodNotAllowed('Renaming calendars is not yet supported');
85
-	}
80
+    /**
81
+     * @inheritDoc
82
+     */
83
+    final public function setName($name) {
84
+        throw new DAV\Exception\MethodNotAllowed('Renaming calendars is not yet supported');
85
+    }
86 86
 
87
-	/**
88
-	 * @inheritDoc
89
-	 */
90
-	final public function createDirectory($name) {
91
-		throw new DAV\Exception\MethodNotAllowed('Creating collections in calendar objects is not allowed');
92
-	}
87
+    /**
88
+     * @inheritDoc
89
+     */
90
+    final public function createDirectory($name) {
91
+        throw new DAV\Exception\MethodNotAllowed('Creating collections in calendar objects is not allowed');
92
+    }
93 93
 
94
-	/**
95
-	 * Checks whether the calendar uri is app-generated
96
-	 *
97
-	 * @param string $calendarUri
98
-	 * @return bool
99
-	 */
100
-	public static function isAppGeneratedCalendar(string $calendarUri):bool {
101
-		return strpos($calendarUri, self::PREFIX) === 0 && substr_count($calendarUri, self::DELIMITER) >= 2;
102
-	}
94
+    /**
95
+     * Checks whether the calendar uri is app-generated
96
+     *
97
+     * @param string $calendarUri
98
+     * @return bool
99
+     */
100
+    public static function isAppGeneratedCalendar(string $calendarUri):bool {
101
+        return strpos($calendarUri, self::PREFIX) === 0 && substr_count($calendarUri, self::DELIMITER) >= 2;
102
+    }
103 103
 
104
-	/**
105
-	 * Splits an app-generated calendar-uri into appId and calendarUri
106
-	 *
107
-	 * @param string $calendarUri
108
-	 * @return array
109
-	 */
110
-	public static function splitAppGeneratedCalendarUri(string $calendarUri):array {
111
-		$array = array_slice(explode(self::DELIMITER, $calendarUri, 3), 1);
112
-		// Check the array has expected amount of elements
113
-		// and none of them is an empty string
114
-		if (\count($array) !== 2 || \in_array('', $array, true)) {
115
-			throw new \InvalidArgumentException('Provided calendar uri was not app-generated');
116
-		}
104
+    /**
105
+     * Splits an app-generated calendar-uri into appId and calendarUri
106
+     *
107
+     * @param string $calendarUri
108
+     * @return array
109
+     */
110
+    public static function splitAppGeneratedCalendarUri(string $calendarUri):array {
111
+        $array = array_slice(explode(self::DELIMITER, $calendarUri, 3), 1);
112
+        // Check the array has expected amount of elements
113
+        // and none of them is an empty string
114
+        if (\count($array) !== 2 || \in_array('', $array, true)) {
115
+            throw new \InvalidArgumentException('Provided calendar uri was not app-generated');
116
+        }
117 117
 
118
-		return $array;
119
-	}
118
+        return $array;
119
+    }
120 120
 
121
-	/**
122
-	 * Checks whether a calendar-name, the user wants to create, violates
123
-	 * the reserved name for calendar uris
124
-	 *
125
-	 * @param string $calendarUri
126
-	 * @return bool
127
-	 */
128
-	public static function doesViolateReservedName(string $calendarUri):bool {
129
-		return strpos($calendarUri, self::PREFIX) === 0;
130
-	}
121
+    /**
122
+     * Checks whether a calendar-name, the user wants to create, violates
123
+     * the reserved name for calendar uris
124
+     *
125
+     * @param string $calendarUri
126
+     * @return bool
127
+     */
128
+    public static function doesViolateReservedName(string $calendarUri):bool {
129
+        return strpos($calendarUri, self::PREFIX) === 0;
130
+    }
131 131
 }
Please login to merge, or discard this patch.