Completed
Push — master ( f740e9...2e26a2 )
by Tim
15s queued 12s
created
Classes/Service/RegExRepService.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -11,44 +11,44 @@
 block discarded – undo
11 11
  */
12 12
 class RegExRepService implements \TYPO3\CMS\Core\SingletonInterface
13 13
 {
14
-    public function process(string $html): string
15
-    {
16
-        $config = $GLOBALS['TSFE']->config['config']['replacer.'];
17
-
18
-        foreach (['search.', 'replace.'] as $section) {
19
-            if (!isset($config[$section]) || !\is_array($config[$section])) {
20
-                throw new \Exception('missing entry @ config.replacer.'.$section);
21
-            }
22
-
23
-            if (preg_match_all('/"([\w\-]+)\.";/', serialize(array_keys($config[$section])), $matches)) {
24
-                foreach ($matches[1] as $key) {
25
-                    $config[$section][$key] = $GLOBALS['TSFE']->cObj
26
-                        ->stdWrap(
27
-                            $config[$section][$key],
28
-                            $config[$section][$key.'.']
29
-                        )
30
-                    ;
31
-                    unset($config[$section][$key.'.']); // keep!
32
-                }
33
-            }
34
-
35
-            ksort($config[$section], \SORT_NATURAL); // for safety only
36
-        }
37
-
38
-        if (\TYPO3\CMS\Core\Core\Environment::getContext()->isDevelopment()) {
39
-            foreach ($config['search.'] as $key => $val) {
40
-                if (false === @preg_match($val, '')) {
41
-                    throw new \Exception(preg_last_error_msg().' : please check your regex syntax @ '."{$key} = {$val}");
42
-                }
43
-            }
44
-        }
45
-
46
-        $arrIntersectKeysCnt = 2 * \count(array_intersect_key($config['search.'], $config['replace.']));
47
-
48
-        if ((bool) (\count($config['search.']) + \count($config['replace.']) - $arrIntersectKeysCnt)) {
49
-            throw new \Exception('config.replacer requests have diverged');
50
-        }
51
-
52
-        return preg_replace($config['search.'], $config['replace.'], $html);
53
-    }
14
+	public function process(string $html): string
15
+	{
16
+		$config = $GLOBALS['TSFE']->config['config']['replacer.'];
17
+
18
+		foreach (['search.', 'replace.'] as $section) {
19
+			if (!isset($config[$section]) || !\is_array($config[$section])) {
20
+				throw new \Exception('missing entry @ config.replacer.'.$section);
21
+			}
22
+
23
+			if (preg_match_all('/"([\w\-]+)\.";/', serialize(array_keys($config[$section])), $matches)) {
24
+				foreach ($matches[1] as $key) {
25
+					$config[$section][$key] = $GLOBALS['TSFE']->cObj
26
+						->stdWrap(
27
+							$config[$section][$key],
28
+							$config[$section][$key.'.']
29
+						)
30
+					;
31
+					unset($config[$section][$key.'.']); // keep!
32
+				}
33
+			}
34
+
35
+			ksort($config[$section], \SORT_NATURAL); // for safety only
36
+		}
37
+
38
+		if (\TYPO3\CMS\Core\Core\Environment::getContext()->isDevelopment()) {
39
+			foreach ($config['search.'] as $key => $val) {
40
+				if (false === @preg_match($val, '')) {
41
+					throw new \Exception(preg_last_error_msg().' : please check your regex syntax @ '."{$key} = {$val}");
42
+				}
43
+			}
44
+		}
45
+
46
+		$arrIntersectKeysCnt = 2 * \count(array_intersect_key($config['search.'], $config['replace.']));
47
+
48
+		if ((bool) (\count($config['search.']) + \count($config['replace.']) - $arrIntersectKeysCnt)) {
49
+			throw new \Exception('config.replacer requests have diverged');
50
+		}
51
+
52
+		return preg_replace($config['search.'], $config['replace.'], $html);
53
+	}
54 54
 }
Please login to merge, or discard this patch.