Code Duplication    Length = 12-14 lines in 4 locations

apps/dav/lib/CalDAV/Calendar.php 2 locations

@@ 203-216 (lines=14) @@
200
201
	}
202
203
	function getChildren() {
204
205
		$objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']);
206
		$children = [];
207
		foreach ($objs as $obj) {
208
			if ($this->isShared() && $obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) {
209
				continue;
210
			}
211
			$obj['acl'] = $this->getChildACL();
212
			$children[] = new CalendarObject($this->caldavBackend, $this->calendarInfo, $obj);
213
		}
214
		return $children;
215
216
	}
217
218
	function getMultipleChildren(array $paths) {
219
@@ 218-231 (lines=14) @@
215
216
	}
217
218
	function getMultipleChildren(array $paths) {
219
220
		$objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths);
221
		$children = [];
222
		foreach ($objs as $obj) {
223
			if ($this->isShared() && $obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) {
224
				continue;
225
			}
226
			$obj['acl'] = $this->getChildACL();
227
			$children[] = new CalendarObject($this->caldavBackend, $this->calendarInfo, $obj);
228
		}
229
		return $children;
230
231
	}
232
233
	function childExists($name) {
234
		$obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name);

apps/dav/lib/CalDAV/PublicCalendar.php 2 locations

@@ 50-61 (lines=12) @@
47
	/**
48
	 * @return PublicCalendarObject[]
49
	 */
50
	public function getChildren() {
51
		$objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']);
52
		$children = [];
53
		foreach ($objs as $obj) {
54
			if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) {
55
				continue;
56
			}
57
			$obj['acl'] = $this->getChildACL();
58
			$children[] = new PublicCalendarObject($this->caldavBackend, $this->calendarInfo, $obj);
59
		}
60
		return $children;
61
	}
62
63
	/**
64
	 * @param string[] $paths
@@ 67-78 (lines=12) @@
64
	 * @param string[] $paths
65
	 * @return PublicCalendarObject[]
66
	 */
67
	public function getMultipleChildren(array $paths) {
68
		$objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths);
69
		$children = [];
70
		foreach ($objs as $obj) {
71
			if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) {
72
				continue;
73
			}
74
			$obj['acl'] = $this->getChildACL();
75
			$children[] = new PublicCalendarObject($this->caldavBackend, $this->calendarInfo, $obj);
76
		}
77
		return $children;
78
	}
79
80
	/**
81
	 * public calendars are always shared