Completed
Push — main ( 051db3...1e7354 )
by Martin
11s
created
src/Twig/DataToTwigConvertor.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public static function nothing(): self
40 40
     {
41
-        return new self(function () {
41
+        return new self(function() {
42 42
             return '';
43 43
         });
44 44
     }
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public static function vars(bool $force = true): self
52 52
     {
53
-        return new self(function (array $data) use ($force) {
53
+        return new self(function(array $data) use ($force) {
54 54
             $content = '';
55 55
             foreach ($data as $key => $value) {
56 56
                 if (is_int($key)) {
57 57
                     continue;
58 58
                 }
59 59
 
60
-                $value = ($force ? '' : "$key is defined ? $key : ") . self::valueToTwig($value);
60
+                $value = ($force ? '' : "$key is defined ? $key : ").self::valueToTwig($value);
61 61
                 $content .= "{% set {$key} = {$value} %}\n";
62 62
             }
63 63
 
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public static function var(string $name, bool $force = true): self
76 76
     {
77
-        return new self(function (array $data) use ($name, $force) {
78
-            $value = ($force ? '' : "$name is defined ? $name : ") . self::valueToTwig($data);
77
+        return new self(function(array $data) use ($name, $force) {
78
+            $value = ($force ? '' : "$name is defined ? $name : ").self::valueToTwig($data);
79 79
 
80 80
             return "{% set {$name} = {$value} %}\n";
81 81
         });
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     protected static function valueToTwig($value): string
90 90
     {
91 91
         if ($value instanceof DateTimeInterface) {
92
-            return '(' . $value->getTimestamp() . "|date_modify('0sec'))";
92
+            return '('.$value->getTimestamp()."|date_modify('0sec'))";
93 93
         }
94 94
 
95 95
         if (is_array($value)) {
Please login to merge, or discard this patch.