diff --git a/composer.json b/composer.json index 606d8c96..00a1cc0d 100755 --- a/composer.json +++ b/composer.json @@ -59,7 +59,8 @@ "siriusphp/upload": "^3.0.1", "filp/whoops": "^2.14.3", - "symfony/console": "^5.3.7" + "symfony/console": "^5.3.7", + "symfony/var-exporter": "^5.3" }, "suggest": { "ext-zend-opcache": "Recommended for better performance", @@ -84,4 +85,4 @@ "victorjonsson/markdowndocs": "^1.3.8", "kint-php/kint": "^3.3" } -} \ No newline at end of file +} diff --git a/src/flextype/core/Serializers/PhpArray.php b/src/flextype/core/Serializers/PhpArray.php index c5d3e0d1..ce490d13 100644 --- a/src/flextype/core/Serializers/PhpArray.php +++ b/src/flextype/core/Serializers/PhpArray.php @@ -9,6 +9,8 @@ declare(strict_types=1); namespace Flextype\Serializers; +use Symfony\Component\VarExporter\VarExporter; + use RuntimeException; use function cache; @@ -27,8 +29,14 @@ class PhpArray */ public function encode($input): string { + $wrap = registry()->get('flextype.settings.serializers.phparray.encode.wrap'); + try { - $data = "get('flextype.settings.serializers.phpcode.encode.wrap'); + try { - $data = var_export($input, true); + if ($wrap) { + $data = "