Code Duplication    Length = 17-17 lines in 2 locations

settings/personal.php 1 location

@@ 197-213 (lines=17) @@
194
	$forms[] = $certificatesTemplate->fetchPage();
195
}
196
197
$formsMap = array_map(function($form){
198
	if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) {
199
		$sectionName = str_replace('<h2'.$regs['class'].'>', '', $regs[0]);
200
		$sectionName = str_replace('</h2>', '', $sectionName);
201
		$anchor = strtolower($sectionName);
202
		$anchor = str_replace(' ', '-', $anchor);
203
204
		return array(
205
			'anchor' => $anchor,
206
			'section-name' => $sectionName,
207
			'form' => $form
208
		);
209
	}
210
	return array(
211
		'form' => $form
212
	);
213
}, $forms);
214
215
$formsAndMore = array_merge($formsAndMore, $formsMap);
216

settings/Controller/AdminSettingsController.php 1 location

@@ 105-121 (lines=17) @@
102
	private function getLegacyForms() {
103
		$forms = \OC_App::getForms('admin');
104
105
		$forms = array_map(function ($form) {
106
			if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) {
107
				$sectionName = str_replace('<h2' . $regs['class'] . '>', '', $regs[0]);
108
				$sectionName = str_replace('</h2>', '', $sectionName);
109
				$anchor = strtolower($sectionName);
110
				$anchor = str_replace(' ', '-', $anchor);
111
112
				return array(
113
					'anchor' => $anchor,
114
					'section-name' => $sectionName,
115
					'form' => $form
116
				);
117
			}
118
			return array(
119
				'form' => $form
120
			);
121
		}, $forms);
122
123
		$out = new \OCP\Template('settings', 'admin/additional');
124
		$out->assign('forms', $forms);