Completed
Push — master ( 9a7adb...d919c6 )
by Martin
01:17
created
src/Twig/DataToTwigConvertor.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public static function nothing(): self
31 31
     {
32
-        return new self(function (array $data) {
32
+        return new self(function(array $data) {
33 33
             return '';
34 34
         });
35 35
     }
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public static function vars(bool $force = true): self
43 43
     {
44
-        return new self(function (array $data) use ($force) {
44
+        return new self(function(array $data) use ($force) {
45 45
             $content = '';
46 46
             foreach ($data as $key => $value) {
47 47
                 if (is_int($key)) {
48 48
                     continue;
49 49
                 }
50
-                $content .= "{% set $key = " . ($force ? '' : "$key is defined ? $key : ") . self::valueToTwig($value) . " %}\n";
50
+                $content .= "{% set $key = ".($force ? '' : "$key is defined ? $key : ").self::valueToTwig($value)." %}\n";
51 51
             }
52 52
 
53 53
             return $content;
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public static function var(string $name, bool $force = true): self
65 65
     {
66
-        return new self(function (array $data) use ($name, $force) {
67
-            return "{% set $name = " . ($force ? '' : "$name is defined ? $name : ") . self::valueToTwig($data) . "%}\n";
66
+        return new self(function(array $data) use ($name, $force) {
67
+            return "{% set $name = ".($force ? '' : "$name is defined ? $name : ").self::valueToTwig($data)."%}\n";
68 68
         });
69 69
     }
70 70
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     protected static function valueToTwig($value): string
84 84
     {
85 85
         if ($value instanceof \DateTimeInterface) {
86
-            return '(' . $value->getTimestamp() . "|date_modify('0sec'))";
86
+            return '('.$value->getTimestamp()."|date_modify('0sec'))";
87 87
         } elseif (is_array($value)) {
88 88
             $twig = '{';
89 89
             foreach ($value as $key => $val) {
Please login to merge, or discard this patch.