[!!!][TASK] Refactor property access in compiled fluid templates
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Classes / Core / Compiler / AbstractCompiledTemplate.php
index efcb4b3..e363739 100644 (file)
@@ -95,4 +95,17 @@ abstract class AbstractCompiledTemplate implements \TYPO3\CMS\Fluid\Core\Parser\
                return static::$defaultEncoding;
        }
 
+       /**
+        * @param array $replacements
+        */
+       public function replacePropertyAccessors($replacements, $file) {
+               $code = file_get_contents($file);
+
+               foreach ($replacements as $pattern => $replacementCode) {
+                       $code = preg_replace($pattern, $replacementCode, $code);
+               }
+
+               file_put_contents($file, $code);
+       }
+
 }