Code Duplication    Length = 26-27 lines in 2 locations

apps/dav/lib/CalDAV/Publishing/PublishPlugin.php 2 locations

@@ 170-196 (lines=27) @@
167
168
		switch ($documentType) {
169
170
			case '{'.self::NS_CALENDARSERVER.'}publish-calendar' :
171
172
			// We can only deal with IShareableCalendar objects
173
			if (!$node instanceof Calendar) {
174
				return;
175
			}
176
			$this->server->transactionType = 'post-publish-calendar';
177
178
			// Getting ACL info
179
			$acl = $this->server->getPlugin('acl');
180
181
			// If there's no ACL support, we allow everything
182
			if ($acl) {
183
				$acl->checkPrivileges($path, '{DAV:}write');
184
			}
185
186
			$node->setPublishStatus(true);
187
188
			// iCloud sends back the 202, so we will too.
189
			$response->setStatus(202);
190
191
			// Adding this because sending a response body may cause issues,
192
			// and I wanted some type of indicator the response was handled.
193
			$response->setHeader('X-Sabre-Status', 'everything-went-well');
194
195
			// Breaking the event chain
196
			return false;
197
198
			case '{'.self::NS_CALENDARSERVER.'}unpublish-calendar' :
199
@@ 198-223 (lines=26) @@
195
			// Breaking the event chain
196
			return false;
197
198
			case '{'.self::NS_CALENDARSERVER.'}unpublish-calendar' :
199
200
			// We can only deal with IShareableCalendar objects
201
			if (!$node instanceof Calendar) {
202
				return;
203
			}
204
			$this->server->transactionType = 'post-unpublish-calendar';
205
206
			// Getting ACL info
207
			$acl = $this->server->getPlugin('acl');
208
209
			// If there's no ACL support, we allow everything
210
			if ($acl) {
211
				$acl->checkPrivileges($path, '{DAV:}write');
212
			}
213
214
			$node->setPublishStatus(false);
215
216
			$response->setStatus(200);
217
218
			// Adding this because sending a response body may cause issues,
219
			// and I wanted some type of indicator the response was handled.
220
			$response->setHeader('X-Sabre-Status', 'everything-went-well');
221
222
			// Breaking the event chain
223
			return false;
224
225
		}
226
	}