Passed
Push — master ( 95fdf8...1b835e )
by Kirill
04:44 queued 10s
created
src/Stempler/src/Transform/Merge/Inject/PHPMixin.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
     {
40 40
         $replace = [];
41 41
 
42
-        foreach ($this->blocks as $block) {
43
-            for ($i = $block['start']; $i <= $block['end']; $i++) {
42
+        foreach ($this->blocks as $block){
43
+            for ($i = $block['start']; $i <= $block['end']; $i++){
44 44
                 $replace[$i] = '';
45 45
             }
46 46
 
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
         }
49 49
 
50 50
         $result = '';
51
-        foreach ($this->tokens as $position => $token) {
52
-            if (array_key_exists($position, $replace)) {
51
+        foreach ($this->tokens as $position => $token){
52
+            if (array_key_exists($position, $replace)){
53 53
                 $result .= $replace[$position];
54 54
                 continue;
55 55
             }
56 56
 
57
-            if (is_string($token)) {
57
+            if (is_string($token)){
58 58
                 $result .= $token;
59 59
                 continue;
60 60
             }
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $replace = [];
76 76
 
77
-        foreach ($this->blocks as $block) {
78
-            for ($i = $block['start']; $i <= $block['end']; $i++) {
77
+        foreach ($this->blocks as $block){
78
+            for ($i = $block['start']; $i <= $block['end']; $i++){
79 79
                 $replace[$i] = '';
80 80
             }
81 81
 
@@ -83,18 +83,18 @@  discard block
 block discarded – undo
83 83
         }
84 84
 
85 85
         $result = '';
86
-        foreach ($this->tokens as $position => $token) {
87
-            if (array_key_exists($position, $replace)) {
86
+        foreach ($this->tokens as $position => $token){
87
+            if (array_key_exists($position, $replace)){
88 88
                 $result .= $replace[$position];
89 89
                 continue;
90 90
             }
91 91
 
92
-            if (is_string($token)) {
92
+            if (is_string($token)){
93 93
                 $result .= $token;
94 94
                 continue;
95 95
             }
96 96
 
97
-            if (in_array($token[0], [T_OPEN_TAG, T_OPEN_TAG_WITH_ECHO, T_CLOSE_TAG, T_ECHO])) {
97
+            if (in_array($token[0], [T_OPEN_TAG, T_OPEN_TAG_WITH_ECHO, T_CLOSE_TAG, T_ECHO])){
98 98
                 continue;
99 99
             }
100 100
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     public function getBlocks(): array
113 113
     {
114 114
         $result = [];
115
-        foreach ($this->blocks as $name => $macro) {
115
+        foreach ($this->blocks as $name => $macro){
116 116
             $result[$name] = $macro['value'];
117 117
         }
118 118
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      */
135 135
     public function set(string $block, string $value): void
136 136
     {
137
-        if (!isset($this->blocks[$block])) {
137
+        if (!isset($this->blocks[$block])){
138 138
             return;
139 139
         }
140 140
 
@@ -148,26 +148,26 @@  discard block
 block discarded – undo
148 148
     {
149 149
         $level = 0;
150 150
         $start = $name = $value = null;
151
-        foreach ($this->tokens as $position => $token) {
152
-            if (!is_array($token)) {
151
+        foreach ($this->tokens as $position => $token){
152
+            if (!is_array($token)){
153 153
                 $token = [$token, $token, 0];
154 154
             }
155 155
 
156
-            switch ($token[0]) {
156
+            switch ($token[0]){
157 157
                 case '(':
158
-                    if ($start !== null) {
158
+                    if ($start !== null){
159 159
                         $level++;
160 160
                         $value .= $token[1];
161 161
                     }
162 162
                     break;
163 163
                 case ')':
164
-                    if ($start === null) {
164
+                    if ($start === null){
165 165
                         break;
166 166
                     }
167 167
 
168 168
                     $level--;
169 169
                     $value .= $token[1];
170
-                    if ($level === 0) {
170
+                    if ($level === 0){
171 171
                         $this->blocks[$name] = [
172 172
                             'start' => $start,
173 173
                             'value' => trim($value),
@@ -179,22 +179,22 @@  discard block
 block discarded – undo
179 179
                     }
180 180
                     break;
181 181
                 case T_STRING:
182
-                    if ($token[1] === $func) {
182
+                    if ($token[1] === $func){
183 183
                         $start = $position;
184 184
                         $value = $token[1];
185 185
                         break;
186 186
                     }
187 187
 
188
-                    if ($start !== null) {
188
+                    if ($start !== null){
189 189
                         $value .= $token[1];
190 190
                     }
191 191
                     break;
192 192
                 case T_CONSTANT_ENCAPSED_STRING:
193
-                    if ($start === null) {
193
+                    if ($start === null){
194 194
                         break;
195 195
                     }
196 196
 
197
-                    if ($name === null) {
197
+                    if ($name === null){
198 198
                         $name = stripcslashes(substr($token[1], 1, -1));
199 199
                     }
200 200
                     $value .= $token[1];
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
                     $value .= $token[1];
204 204
                     break;
205 205
                 default:
206
-                    if ($start !== null) {
206
+                    if ($start !== null){
207 207
                         $value .= $token[1];
208 208
                     }
209 209
             }
Please login to merge, or discard this patch.
Braces   +48 added lines, -24 removed lines patch added patch discarded remove patch
@@ -39,8 +39,10 @@  discard block
 block discarded – undo
39 39
     {
40 40
         $replace = [];
41 41
 
42
-        foreach ($this->blocks as $block) {
43
-            for ($i = $block['start']; $i <= $block['end']; $i++) {
42
+        foreach ($this->blocks as $block)
43
+        {
44
+            for ($i = $block['start']; $i <= $block['end']; $i++)
45
+            {
44 46
                 $replace[$i] = '';
45 47
             }
46 48
 
@@ -48,13 +50,16 @@  discard block
 block discarded – undo
48 50
         }
49 51
 
50 52
         $result = '';
51
-        foreach ($this->tokens as $position => $token) {
52
-            if (array_key_exists($position, $replace)) {
53
+        foreach ($this->tokens as $position => $token)
54
+        {
55
+            if (array_key_exists($position, $replace))
56
+            {
53 57
                 $result .= $replace[$position];
54 58
                 continue;
55 59
             }
56 60
 
57
-            if (is_string($token)) {
61
+            if (is_string($token))
62
+            {
58 63
                 $result .= $token;
59 64
                 continue;
60 65
             }
@@ -74,8 +79,10 @@  discard block
 block discarded – undo
74 79
     {
75 80
         $replace = [];
76 81
 
77
-        foreach ($this->blocks as $block) {
78
-            for ($i = $block['start']; $i <= $block['end']; $i++) {
82
+        foreach ($this->blocks as $block)
83
+        {
84
+            for ($i = $block['start']; $i <= $block['end']; $i++)
85
+            {
79 86
                 $replace[$i] = '';
80 87
             }
81 88
 
@@ -83,18 +90,22 @@  discard block
 block discarded – undo
83 90
         }
84 91
 
85 92
         $result = '';
86
-        foreach ($this->tokens as $position => $token) {
87
-            if (array_key_exists($position, $replace)) {
93
+        foreach ($this->tokens as $position => $token)
94
+        {
95
+            if (array_key_exists($position, $replace))
96
+            {
88 97
                 $result .= $replace[$position];
89 98
                 continue;
90 99
             }
91 100
 
92
-            if (is_string($token)) {
101
+            if (is_string($token))
102
+            {
93 103
                 $result .= $token;
94 104
                 continue;
95 105
             }
96 106
 
97
-            if (in_array($token[0], [T_OPEN_TAG, T_OPEN_TAG_WITH_ECHO, T_CLOSE_TAG, T_ECHO])) {
107
+            if (in_array($token[0], [T_OPEN_TAG, T_OPEN_TAG_WITH_ECHO, T_CLOSE_TAG, T_ECHO]))
108
+            {
98 109
                 continue;
99 110
             }
100 111
 
@@ -112,7 +123,8 @@  discard block
 block discarded – undo
112 123
     public function getBlocks(): array
113 124
     {
114 125
         $result = [];
115
-        foreach ($this->blocks as $name => $macro) {
126
+        foreach ($this->blocks as $name => $macro)
127
+        {
116 128
             $result[$name] = $macro['value'];
117 129
         }
118 130
 
@@ -134,7 +146,8 @@  discard block
 block discarded – undo
134 146
      */
135 147
     public function set(string $block, string $value): void
136 148
     {
137
-        if (!isset($this->blocks[$block])) {
149
+        if (!isset($this->blocks[$block]))
150
+        {
138 151
             return;
139 152
         }
140 153
 
@@ -148,26 +161,32 @@  discard block
 block discarded – undo
148 161
     {
149 162
         $level = 0;
150 163
         $start = $name = $value = null;
151
-        foreach ($this->tokens as $position => $token) {
152
-            if (!is_array($token)) {
164
+        foreach ($this->tokens as $position => $token)
165
+        {
166
+            if (!is_array($token))
167
+            {
153 168
                 $token = [$token, $token, 0];
154 169
             }
155 170
 
156
-            switch ($token[0]) {
171
+            switch ($token[0])
172
+            {
157 173
                 case '(':
158
-                    if ($start !== null) {
174
+                    if ($start !== null)
175
+                    {
159 176
                         $level++;
160 177
                         $value .= $token[1];
161 178
                     }
162 179
                     break;
163 180
                 case ')':
164
-                    if ($start === null) {
181
+                    if ($start === null)
182
+                    {
165 183
                         break;
166 184
                     }
167 185
 
168 186
                     $level--;
169 187
                     $value .= $token[1];
170
-                    if ($level === 0) {
188
+                    if ($level === 0)
189
+                    {
171 190
                         $this->blocks[$name] = [
172 191
                             'start' => $start,
173 192
                             'value' => trim($value),
@@ -179,22 +198,26 @@  discard block
 block discarded – undo
179 198
                     }
180 199
                     break;
181 200
                 case T_STRING:
182
-                    if ($token[1] === $func) {
201
+                    if ($token[1] === $func)
202
+                    {
183 203
                         $start = $position;
184 204
                         $value = $token[1];
185 205
                         break;
186 206
                     }
187 207
 
188
-                    if ($start !== null) {
208
+                    if ($start !== null)
209
+                    {
189 210
                         $value .= $token[1];
190 211
                     }
191 212
                     break;
192 213
                 case T_CONSTANT_ENCAPSED_STRING:
193
-                    if ($start === null) {
214
+                    if ($start === null)
215
+                    {
194 216
                         break;
195 217
                     }
196 218
 
197
-                    if ($name === null) {
219
+                    if ($name === null)
220
+                    {
198 221
                         $name = stripcslashes(substr($token[1], 1, -1));
199 222
                     }
200 223
                     $value .= $token[1];
@@ -203,7 +226,8 @@  discard block
 block discarded – undo
203 226
                     $value .= $token[1];
204 227
                     break;
205 228
                 default:
206
-                    if ($start !== null) {
229
+                    if ($start !== null)
230
+                    {
207 231
                         $value .= $token[1];
208 232
                     }
209 233
             }
Please login to merge, or discard this patch.
src/Stempler/src/Transform/Merge/Inject/InjectPHP.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -59,20 +59,20 @@  discard block
 block discarded – undo
59 59
                 strpos($node->content, self::PHP_MACRO_FUNCTION) === false
60 60
                 && strpos($node->content, self::PHP_MARCO_EXISTS_FUNCTION) === false
61 61
             )
62
-        ) {
62
+        ){
63 63
             return null;
64 64
         }
65 65
 
66 66
         $php = new PHPMixin($node->tokens, self::PHP_MACRO_FUNCTION);
67
-        foreach ($this->blocks->getNames() as $name) {
67
+        foreach ($this->blocks->getNames() as $name){
68 68
             $block = $this->blocks->get($name);
69 69
 
70
-            if ($this->isReference($block)) {
70
+            if ($this->isReference($block)){
71 71
                 // resolved on later stage
72 72
                 continue;
73 73
             }
74 74
 
75
-            if ($php->has($name)) {
75
+            if ($php->has($name)){
76 76
                 $php->set($name, $this->trimPHP($this->blocks->claim($name)));
77 77
             }
78 78
         }
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
81 81
         $node->tokens = token_get_all($node->content);
82 82
 
83 83
         $exists = new PHPMixin($node->tokens, self::PHP_MARCO_EXISTS_FUNCTION);
84
-        foreach ($this->blocks->getNames() as $name) {
84
+        foreach ($this->blocks->getNames() as $name){
85 85
             $block = $this->blocks->get($name);
86 86
 
87
-            if ($this->isReference($block)) {
87
+            if ($this->isReference($block)){
88 88
                 // resolved on later stage
89 89
                 continue;
90 90
             }
91 91
 
92
-            if ($exists->has($name)) {
92
+            if ($exists->has($name)){
93 93
                 $exists->set($name, 'true');
94 94
             }
95 95
         }
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
      */
112 112
     private function isReference($node): bool
113 113
     {
114
-        switch (true) {
114
+        switch (true){
115 115
             case is_array($node):
116
-                foreach ($node as $child) {
117
-                    if ($this->isReference($child)) {
116
+                foreach ($node as $child){
117
+                    if ($this->isReference($child)){
118 118
                         return true;
119 119
                     }
120 120
                 }
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
                 return $this->isReference($node->getValue());
126 126
 
127 127
             case $node instanceof Mixin:
128
-                foreach ($node->nodes as $child) {
129
-                    if ($this->isReference($child)) {
128
+                foreach ($node->nodes as $child){
129
+                    if ($this->isReference($child)){
130 130
                         return true;
131 131
                     }
132 132
                 }
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
      */
147 147
     private function trimPHP($node): string
148 148
     {
149
-        switch (true) {
149
+        switch (true){
150 150
             case is_array($node):
151 151
                 $result = [];
152
-                foreach ($node as $child) {
152
+                foreach ($node as $child){
153 153
                     $result[] = $this->trimPHP($child);
154 154
                 }
155 155
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
             case $node instanceof Mixin:
159 159
                 $result = [];
160
-                foreach ($node->nodes as $child) {
160
+                foreach ($node->nodes as $child){
161 161
                     $result[] = $this->trimPHP($child);
162 162
                 }
163 163
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
                 return trim($node->body);
171 171
 
172 172
             case $node instanceof PHP:
173
-                if ($node->getContext()->getValue(PHP::ORIGINAL_BODY) !== null) {
173
+                if ($node->getContext()->getValue(PHP::ORIGINAL_BODY) !== null){
174 174
                     return $node->getContext()->getValue(PHP::ORIGINAL_BODY);
175 175
                 }
176 176
 
@@ -190,13 +190,13 @@  discard block
 block discarded – undo
190 190
     private function exportValue(Raw $node): string
191 191
     {
192 192
         $value = $node->content;
193
-        switch (true) {
193
+        switch (true){
194 194
             case strtolower($value) === 'true':
195 195
                 return 'true';
196 196
             case strtolower($value) === 'false':
197 197
                 return 'false';
198 198
             case is_float($value) || is_numeric($value):
199
-                return (string) $value;
199
+                return (string)$value;
200 200
         }
201 201
 
202 202
         return var_export($node->content, true);
Please login to merge, or discard this patch.
Braces   +32 added lines, -16 removed lines patch added patch discarded remove patch
@@ -64,15 +64,18 @@  discard block
 block discarded – undo
64 64
         }
65 65
 
66 66
         $php = new PHPMixin($node->tokens, self::PHP_MACRO_FUNCTION);
67
-        foreach ($this->blocks->getNames() as $name) {
67
+        foreach ($this->blocks->getNames() as $name)
68
+        {
68 69
             $block = $this->blocks->get($name);
69 70
 
70
-            if ($this->isReference($block)) {
71
+            if ($this->isReference($block))
72
+            {
71 73
                 // resolved on later stage
72 74
                 continue;
73 75
             }
74 76
 
75
-            if ($php->has($name)) {
77
+            if ($php->has($name))
78
+            {
76 79
                 $php->set($name, $this->trimPHP($this->blocks->claim($name)));
77 80
             }
78 81
         }
@@ -81,15 +84,18 @@  discard block
 block discarded – undo
81 84
         $node->tokens = token_get_all($node->content);
82 85
 
83 86
         $exists = new PHPMixin($node->tokens, self::PHP_MARCO_EXISTS_FUNCTION);
84
-        foreach ($this->blocks->getNames() as $name) {
87
+        foreach ($this->blocks->getNames() as $name)
88
+        {
85 89
             $block = $this->blocks->get($name);
86 90
 
87
-            if ($this->isReference($block)) {
91
+            if ($this->isReference($block))
92
+            {
88 93
                 // resolved on later stage
89 94
                 continue;
90 95
             }
91 96
 
92
-            if ($exists->has($name)) {
97
+            if ($exists->has($name))
98
+            {
93 99
                 $exists->set($name, 'true');
94 100
             }
95 101
         }
@@ -111,10 +117,13 @@  discard block
 block discarded – undo
111 117
      */
112 118
     private function isReference($node): bool
113 119
     {
114
-        switch (true) {
120
+        switch (true)
121
+        {
115 122
             case is_array($node):
116
-                foreach ($node as $child) {
117
-                    if ($this->isReference($child)) {
123
+                foreach ($node as $child)
124
+                {
125
+                    if ($this->isReference($child))
126
+                    {
118 127
                         return true;
119 128
                     }
120 129
                 }
@@ -125,8 +134,10 @@  discard block
 block discarded – undo
125 134
                 return $this->isReference($node->getValue());
126 135
 
127 136
             case $node instanceof Mixin:
128
-                foreach ($node->nodes as $child) {
129
-                    if ($this->isReference($child)) {
137
+                foreach ($node->nodes as $child)
138
+                {
139
+                    if ($this->isReference($child))
140
+                    {
130 141
                         return true;
131 142
                     }
132 143
                 }
@@ -146,10 +157,12 @@  discard block
 block discarded – undo
146 157
      */
147 158
     private function trimPHP($node): string
148 159
     {
149
-        switch (true) {
160
+        switch (true)
161
+        {
150 162
             case is_array($node):
151 163
                 $result = [];
152
-                foreach ($node as $child) {
164
+                foreach ($node as $child)
165
+                {
153 166
                     $result[] = $this->trimPHP($child);
154 167
                 }
155 168
 
@@ -157,7 +170,8 @@  discard block
 block discarded – undo
157 170
 
158 171
             case $node instanceof Mixin:
159 172
                 $result = [];
160
-                foreach ($node->nodes as $child) {
173
+                foreach ($node->nodes as $child)
174
+                {
161 175
                     $result[] = $this->trimPHP($child);
162 176
                 }
163 177
 
@@ -170,7 +184,8 @@  discard block
 block discarded – undo
170 184
                 return trim($node->body);
171 185
 
172 186
             case $node instanceof PHP:
173
-                if ($node->getContext()->getValue(PHP::ORIGINAL_BODY) !== null) {
187
+                if ($node->getContext()->getValue(PHP::ORIGINAL_BODY) !== null)
188
+                {
174 189
                     return $node->getContext()->getValue(PHP::ORIGINAL_BODY);
175 190
                 }
176 191
 
@@ -190,7 +205,8 @@  discard block
 block discarded – undo
190 205
     private function exportValue(Raw $node): string
191 206
     {
192 207
         $value = $node->content;
193
-        switch (true) {
208
+        switch (true)
209
+        {
194 210
             case strtolower($value) === 'true':
195 211
                 return 'true';
196 212
             case strtolower($value) === 'false':
Please login to merge, or discard this patch.
src/Stempler/src/Transform/Visitor/DefineAttributes.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,15 +30,15 @@
 block discarded – undo
30 30
      */
31 31
     public function enterNode($node, VisitorContext $ctx)
32 32
     {
33
-        if (!$node instanceof Attr || $node->name !== self::AGGREGATE_ATTRIBUTE) {
33
+        if (!$node instanceof Attr || $node->name !== self::AGGREGATE_ATTRIBUTE){
34 34
             return null;
35 35
         }
36 36
 
37
-        if ($node->value instanceof Nil) {
37
+        if ($node->value instanceof Nil){
38 38
             return new Aggregate($node->getContext());
39 39
         }
40 40
 
41
-        if (!is_string($node->value)) {
41
+        if (!is_string($node->value)){
42 42
             return null;
43 43
         }
44 44
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,15 +30,18 @@
 block discarded – undo
30 30
      */
31 31
     public function enterNode($node, VisitorContext $ctx)
32 32
     {
33
-        if (!$node instanceof Attr || $node->name !== self::AGGREGATE_ATTRIBUTE) {
33
+        if (!$node instanceof Attr || $node->name !== self::AGGREGATE_ATTRIBUTE)
34
+        {
34 35
             return null;
35 36
         }
36 37
 
37
-        if ($node->value instanceof Nil) {
38
+        if ($node->value instanceof Nil)
39
+        {
38 40
             return new Aggregate($node->getContext());
39 41
         }
40 42
 
41
-        if (!is_string($node->value)) {
43
+        if (!is_string($node->value))
44
+        {
42 45
             return null;
43 46
         }
44 47
 
Please login to merge, or discard this patch.
src/Stempler/src/Transform/Visitor/DefineStacks.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function enterNode($node, VisitorContext $ctx)
32 32
     {
33
-        if ($node instanceof Tag && strpos($node->name, $this->stackKeyword) === 0) {
33
+        if ($node instanceof Tag && strpos($node->name, $this->stackKeyword) === 0){
34 34
             return $this->registerAggregate(StackContext::on($ctx), $node);
35 35
         }
36 36
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     private function registerAggregate(StackContext $ctx, Tag $node)
53 53
     {
54 54
         $name = $this->stackName($node);
55
-        if ($name === null) {
55
+        if ($name === null){
56 56
             return $node;
57 57
         }
58 58
 
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
     private function stackName(Tag $tag): ?string
73 73
     {
74 74
         $options = [];
75
-        foreach ($tag->attrs as $attr) {
76
-            if (is_string($attr->value)) {
75
+        foreach ($tag->attrs as $attr){
76
+            if (is_string($attr->value)){
77 77
                 $options[$attr->name] = trim($attr->value, '\'"');
78 78
             }
79 79
         }
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
     private function stackLevel(Tag $tag): int
89 89
     {
90 90
         $options = [];
91
-        foreach ($tag->attrs as $attr) {
92
-            if (is_string($attr->value)) {
91
+        foreach ($tag->attrs as $attr){
92
+            if (is_string($attr->value)){
93 93
                 $options[$attr->name] = trim($attr->value, '\'"');
94 94
             }
95 95
         }
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,7 +30,8 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function enterNode($node, VisitorContext $ctx)
32 32
     {
33
-        if ($node instanceof Tag && strpos($node->name, $this->stackKeyword) === 0) {
33
+        if ($node instanceof Tag && strpos($node->name, $this->stackKeyword) === 0)
34
+        {
34 35
             return $this->registerAggregate(StackContext::on($ctx), $node);
35 36
         }
36 37
 
@@ -52,7 +53,8 @@  discard block
 block discarded – undo
52 53
     private function registerAggregate(StackContext $ctx, Tag $node)
53 54
     {
54 55
         $name = $this->stackName($node);
55
-        if ($name === null) {
56
+        if ($name === null)
57
+        {
56 58
             return $node;
57 59
         }
58 60
 
@@ -72,8 +74,10 @@  discard block
 block discarded – undo
72 74
     private function stackName(Tag $tag): ?string
73 75
     {
74 76
         $options = [];
75
-        foreach ($tag->attrs as $attr) {
76
-            if (is_string($attr->value)) {
77
+        foreach ($tag->attrs as $attr)
78
+        {
79
+            if (is_string($attr->value))
80
+            {
77 81
                 $options[$attr->name] = trim($attr->value, '\'"');
78 82
             }
79 83
         }
@@ -88,8 +92,10 @@  discard block
 block discarded – undo
88 92
     private function stackLevel(Tag $tag): int
89 93
     {
90 94
         $options = [];
91
-        foreach ($tag->attrs as $attr) {
92
-            if (is_string($attr->value)) {
95
+        foreach ($tag->attrs as $attr)
96
+        {
97
+            if (is_string($attr->value))
98
+            {
93 99
                 $options[$attr->name] = trim($attr->value, '\'"');
94 100
             }
95 101
         }
Please login to merge, or discard this patch.
src/Stempler/src/Transform/Visitor/DefineBlocks.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public function enterNode($node, VisitorContext $ctx)
35 35
     {
36
-        if ($node instanceof Tag) {
36
+        if ($node instanceof Tag){
37 37
             return $this->makeBlock($node);
38 38
         }
39 39
 
40
-        if ($node instanceof Inline) {
40
+        if ($node instanceof Inline){
41 41
             $block = new Block($node->name, $node->getContext());
42
-            if ($node->value !== null) {
42
+            if ($node->value !== null){
43 43
                 $block->nodes[] = new Raw($node->value);
44 44
             }
45 45
 
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
     private function makeBlock(Tag $node): ?NodeInterface
66 66
     {
67 67
         $name = null;
68
-        foreach ($this->prefix as $prefix) {
69
-            if (strpos($node->name, $prefix) === 0) {
68
+        foreach ($this->prefix as $prefix){
69
+            if (strpos($node->name, $prefix) === 0){
70 70
                 $name = substr($node->name, strlen($prefix));
71 71
                 break;
72 72
             }
73 73
         }
74 74
 
75
-        if ($name === null) {
75
+        if ($name === null){
76 76
             return null;
77 77
         }
78 78
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,13 +33,16 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public function enterNode($node, VisitorContext $ctx)
35 35
     {
36
-        if ($node instanceof Tag) {
36
+        if ($node instanceof Tag)
37
+        {
37 38
             return $this->makeBlock($node);
38 39
         }
39 40
 
40
-        if ($node instanceof Inline) {
41
+        if ($node instanceof Inline)
42
+        {
41 43
             $block = new Block($node->name, $node->getContext());
42
-            if ($node->value !== null) {
44
+            if ($node->value !== null)
45
+            {
43 46
                 $block->nodes[] = new Raw($node->value);
44 47
             }
45 48
 
@@ -65,14 +68,17 @@  discard block
 block discarded – undo
65 68
     private function makeBlock(Tag $node): ?NodeInterface
66 69
     {
67 70
         $name = null;
68
-        foreach ($this->prefix as $prefix) {
69
-            if (strpos($node->name, $prefix) === 0) {
71
+        foreach ($this->prefix as $prefix)
72
+        {
73
+            if (strpos($node->name, $prefix) === 0)
74
+            {
70 75
                 $name = substr($node->name, strlen($prefix));
71 76
                 break;
72 77
             }
73 78
         }
74 79
 
75
-        if ($name === null) {
80
+        if ($name === null)
81
+        {
76 82
             return null;
77 83
         }
78 84
 
Please login to merge, or discard this patch.
src/Stempler/src/Transform/Visitor/DefineHidden.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
      */
34 34
     public function leaveNode($node, VisitorContext $ctx)
35 35
     {
36
-        if ($node instanceof Tag && strpos($node->name, $this->hiddenKeyword) === 0) {
36
+        if ($node instanceof Tag && strpos($node->name, $this->hiddenKeyword) === 0){
37 37
             return new Hidden([$node]);
38 38
         }
39 39
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,8 @@
 block discarded – undo
33 33
      */
34 34
     public function leaveNode($node, VisitorContext $ctx)
35 35
     {
36
-        if ($node instanceof Tag && strpos($node->name, $this->hiddenKeyword) === 0) {
36
+        if ($node instanceof Tag && strpos($node->name, $this->hiddenKeyword) === 0)
37
+        {
37 38
             return new Hidden([$node]);
38 39
         }
39 40
 
Please login to merge, or discard this patch.
src/Stempler/src/Compiler/Renderer/PHPRenderer.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
      */
24 24
     public function render(Compiler $compiler, Compiler\Result $result, NodeInterface $node): bool
25 25
     {
26
-        if ($node instanceof PHP) {
26
+        if ($node instanceof PHP){
27 27
             $result->push($node->content, $node->getContext());
28 28
             return true;
29 29
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,8 @@
 block discarded – undo
23 23
      */
24 24
     public function render(Compiler $compiler, Compiler\Result $result, NodeInterface $node): bool
25 25
     {
26
-        if ($node instanceof PHP) {
26
+        if ($node instanceof PHP)
27
+        {
27 28
             $result->push($node->content, $node->getContext());
28 29
             return true;
29 30
         }
Please login to merge, or discard this patch.
src/Stempler/src/Compiler/Renderer/HTMLRenderer.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function render(Compiler $compiler, Compiler\Result $result, NodeInterface $node): bool
29 29
     {
30
-        switch (true) {
30
+        switch (true){
31 31
             case $node instanceof Tag:
32 32
                 $this->tag($compiler, $result, $node);
33 33
                 return true;
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
     {
52 52
         $result->push(sprintf('<%s', $node->name), $node->getContext());
53 53
 
54
-        foreach ($node->attrs as $attr) {
55
-            if (!$attr instanceof Attribute) {
54
+        foreach ($node->attrs as $attr){
55
+            if (!$attr instanceof Attribute){
56 56
                 $compiler->compile($attr, $result);
57 57
                 continue;
58 58
             }
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 
63 63
         $result->push(sprintf('%s>', $node->void ? '/' : ''), null);
64 64
 
65
-        foreach ($node->nodes as $child) {
65
+        foreach ($node->nodes as $child){
66 66
             $compiler->compile($child, $result);
67 67
         }
68 68
 
69
-        if (!$node->void) {
69
+        if (!$node->void){
70 70
             $result->push(sprintf('</%s>', $node->name), null);
71 71
         }
72 72
     }
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
      */
79 79
     private function attribute(Compiler $compiler, Compiler\Result $result, Attr $node): void
80 80
     {
81
-        if ($node->name instanceof NodeInterface) {
81
+        if ($node->name instanceof NodeInterface){
82 82
             $result->push(' ', null);
83 83
             $compiler->compile($node->name, $result);
84
-        } else {
84
+        }else{
85 85
             $result->push(sprintf(' %s', $node->name), $node->getContext());
86 86
         }
87 87
 
88 88
         $value = $node->value;
89
-        if ($value instanceof Nil) {
89
+        if ($value instanceof Nil){
90 90
             return;
91 91
         }
92 92
 
93
-        if ($value instanceof NodeInterface) {
93
+        if ($value instanceof NodeInterface){
94 94
             $result->push('=', null);
95 95
             $compiler->compile($value, $result);
96 96
             return;
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
      */
107 107
     private function verbatim(Compiler $compiler, Compiler\Result $result, Verbatim $node): void
108 108
     {
109
-        foreach ($node->nodes as $child) {
110
-            if (is_string($child)) {
109
+        foreach ($node->nodes as $child){
110
+            if (is_string($child)){
111 111
                 $result->push($child, null);
112 112
                 continue;
113 113
             }
Please login to merge, or discard this patch.
Braces   +23 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,7 +27,8 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function render(Compiler $compiler, Compiler\Result $result, NodeInterface $node): bool
29 29
     {
30
-        switch (true) {
30
+        switch (true)
31
+        {
31 32
             case $node instanceof Tag:
32 33
                 $this->tag($compiler, $result, $node);
33 34
                 return true;
@@ -51,8 +52,10 @@  discard block
 block discarded – undo
51 52
     {
52 53
         $result->push(sprintf('<%s', $node->name), $node->getContext());
53 54
 
54
-        foreach ($node->attrs as $attr) {
55
-            if (!$attr instanceof Attribute) {
55
+        foreach ($node->attrs as $attr)
56
+        {
57
+            if (!$attr instanceof Attribute)
58
+            {
56 59
                 $compiler->compile($attr, $result);
57 60
                 continue;
58 61
             }
@@ -62,11 +65,13 @@  discard block
 block discarded – undo
62 65
 
63 66
         $result->push(sprintf('%s>', $node->void ? '/' : ''), null);
64 67
 
65
-        foreach ($node->nodes as $child) {
68
+        foreach ($node->nodes as $child)
69
+        {
66 70
             $compiler->compile($child, $result);
67 71
         }
68 72
 
69
-        if (!$node->void) {
73
+        if (!$node->void)
74
+        {
70 75
             $result->push(sprintf('</%s>', $node->name), null);
71 76
         }
72 77
     }
@@ -78,19 +83,24 @@  discard block
 block discarded – undo
78 83
      */
79 84
     private function attribute(Compiler $compiler, Compiler\Result $result, Attr $node): void
80 85
     {
81
-        if ($node->name instanceof NodeInterface) {
86
+        if ($node->name instanceof NodeInterface)
87
+        {
82 88
             $result->push(' ', null);
83 89
             $compiler->compile($node->name, $result);
84
-        } else {
90
+        }
91
+        else
92
+        {
85 93
             $result->push(sprintf(' %s', $node->name), $node->getContext());
86 94
         }
87 95
 
88 96
         $value = $node->value;
89
-        if ($value instanceof Nil) {
97
+        if ($value instanceof Nil)
98
+        {
90 99
             return;
91 100
         }
92 101
 
93
-        if ($value instanceof NodeInterface) {
102
+        if ($value instanceof NodeInterface)
103
+        {
94 104
             $result->push('=', null);
95 105
             $compiler->compile($value, $result);
96 106
             return;
@@ -106,8 +116,10 @@  discard block
 block discarded – undo
106 116
      */
107 117
     private function verbatim(Compiler $compiler, Compiler\Result $result, Verbatim $node): void
108 118
     {
109
-        foreach ($node->nodes as $child) {
110
-            if (is_string($child)) {
119
+        foreach ($node->nodes as $child)
120
+        {
121
+            if (is_string($child))
122
+            {
111 123
                 $result->push($child, null);
112 124
                 continue;
113 125
             }
Please login to merge, or discard this patch.
src/Stempler/src/Compiler/Renderer/DynamicRenderer.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     public function __construct(
37 37
         DirectiveRendererInterface $directiveRenderer = null,
38 38
         string $defaultFilter = self::DEFAULT_FILTER
39
-    ) {
39
+    ){
40 40
         $this->directiveRenderer = $directiveRenderer;
41 41
         $this->defaultFilter = $defaultFilter;
42 42
     }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function render(Compiler $compiler, Compiler\Result $result, NodeInterface $node): bool
48 48
     {
49
-        switch (true) {
49
+        switch (true){
50 50
             case $node instanceof Output:
51 51
                 $this->output($result, $node);
52 52
                 return true;
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
      */
67 67
     private function directive(Compiler\Result $source, Directive $directive): void
68 68
     {
69
-        if ($this->directiveRenderer !== null) {
69
+        if ($this->directiveRenderer !== null){
70 70
             $result = $this->directiveRenderer->render($directive);
71
-            if ($result !== null) {
71
+            if ($result !== null){
72 72
                 $source->push($result, $directive->getContext());
73 73
                 return;
74 74
             }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     private function output(Compiler\Result $source, Output $output): void
88 88
     {
89
-        if ($output->rawOutput) {
89
+        if ($output->rawOutput){
90 90
             $source->push(sprintf('<?php echo %s; ?>', trim($output->body)), $output->getContext());
91 91
             return;
92 92
         }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,7 +46,8 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function render(Compiler $compiler, Compiler\Result $result, NodeInterface $node): bool
48 48
     {
49
-        switch (true) {
49
+        switch (true)
50
+        {
50 51
             case $node instanceof Output:
51 52
                 $this->output($result, $node);
52 53
                 return true;
@@ -66,9 +67,11 @@  discard block
 block discarded – undo
66 67
      */
67 68
     private function directive(Compiler\Result $source, Directive $directive): void
68 69
     {
69
-        if ($this->directiveRenderer !== null) {
70
+        if ($this->directiveRenderer !== null)
71
+        {
70 72
             $result = $this->directiveRenderer->render($directive);
71
-            if ($result !== null) {
73
+            if ($result !== null)
74
+            {
72 75
                 $source->push($result, $directive->getContext());
73 76
                 return;
74 77
             }
@@ -86,7 +89,8 @@  discard block
 block discarded – undo
86 89
      */
87 90
     private function output(Compiler\Result $source, Output $output): void
88 91
     {
89
-        if ($output->rawOutput) {
92
+        if ($output->rawOutput)
93
+        {
90 94
             $source->push(sprintf('<?php echo %s; ?>', trim($output->body)), $output->getContext());
91 95
             return;
92 96
         }
Please login to merge, or discard this patch.