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

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