Passed
Pull Request — master (#592)
by Aleksei
06:09
created
tests/Framework/ConsoleTest.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
     private function cleanupMigrations(): void
33 33
     {
34 34
         $fs = new Files();
35
-        if ($fs->isDirectory(__DIR__ . '/../app/migrations')) {
36
-            $fs->deleteDirectory(__DIR__ . '/../app/migrations');
35
+        if ($fs->isDirectory(__DIR__.'/../app/migrations')){
36
+            $fs->deleteDirectory(__DIR__.'/../app/migrations');
37 37
         }
38 38
     }
39 39
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         $fs = new Files();
47 47
         $runtime = $this->app->get(DirectoriesInterface::class)->get('runtime');
48 48
 
49
-        if ($fs->isDirectory($runtime)) {
49
+        if ($fs->isDirectory($runtime)){
50 50
             $fs->deleteDirectory($runtime);
51 51
         }
52 52
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,8 @@  discard block
 block discarded – undo
32 32
     private function cleanupMigrations(): void
33 33
     {
34 34
         $fs = new Files();
35
-        if ($fs->isDirectory(__DIR__ . '/../app/migrations')) {
35
+        if ($fs->isDirectory(__DIR__ . '/../app/migrations'))
36
+        {
36 37
             $fs->deleteDirectory(__DIR__ . '/../app/migrations');
37 38
         }
38 39
     }
@@ -46,7 +47,8 @@  discard block
 block discarded – undo
46 47
         $fs = new Files();
47 48
         $runtime = $this->app->get(DirectoriesInterface::class)->get('runtime');
48 49
 
49
-        if ($fs->isDirectory($runtime)) {
50
+        if ($fs->isDirectory($runtime))
51
+        {
50 52
             $fs->deleteDirectory($runtime);
51 53
         }
52 54
     }
Please login to merge, or discard this patch.
src/Security/src/Command/RolePermissionsCommand.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
     {
31 31
         $role = $this->argument('role');
32 32
 
33
-        if ($role !== null && !$rbac->hasRole($role)) {
33
+        if ($role !== null && !$rbac->hasRole($role)){
34 34
             throw new CommandException('Unknown role provided');
35 35
         }
36 36
 
37
-        if ($role !== null) {
37
+        if ($role !== null){
38 38
             $rows = $this->getRolePermissions($role, $rbac);
39
-        } else {
39
+        }else{
40 40
             $rows = [];
41 41
 
42
-            foreach ($rbac->getRoles() as $role) {
42
+            foreach ($rbac->getRoles() as $role){
43 43
                 /** @noinspection SlowArrayOperationsInLoopInspection */
44 44
                 $rows = array_merge(
45 45
                     $this->getRolePermissions($role, $rbac),
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $permissions = [];
69 69
 
70
-        foreach ($rbac->getPermissions($role) as $permission => $rule) {
70
+        foreach ($rbac->getPermissions($role) as $permission => $rule){
71 71
             $permissions[] = [
72 72
                 'role' => $role,
73 73
                 'permission' => $permission,
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,16 +30,21 @@  discard block
 block discarded – undo
30 30
     {
31 31
         $role = $this->argument('role');
32 32
 
33
-        if ($role !== null && !$rbac->hasRole($role)) {
33
+        if ($role !== null && !$rbac->hasRole($role))
34
+        {
34 35
             throw new CommandException('Unknown role provided');
35 36
         }
36 37
 
37
-        if ($role !== null) {
38
+        if ($role !== null)
39
+        {
38 40
             $rows = $this->getRolePermissions($role, $rbac);
39
-        } else {
41
+        }
42
+        else
43
+        {
40 44
             $rows = [];
41 45
 
42
-            foreach ($rbac->getRoles() as $role) {
46
+            foreach ($rbac->getRoles() as $role)
47
+            {
43 48
                 /** @noinspection SlowArrayOperationsInLoopInspection */
44 49
                 $rows = array_merge(
45 50
                     $this->getRolePermissions($role, $rbac),
@@ -67,7 +72,8 @@  discard block
 block discarded – undo
67 72
     {
68 73
         $permissions = [];
69 74
 
70
-        foreach ($rbac->getPermissions($role) as $permission => $rule) {
75
+        foreach ($rbac->getPermissions($role) as $permission => $rule)
76
+        {
71 77
             $permissions[] = [
72 78
                 'role' => $role,
73 79
                 'permission' => $permission,
Please login to merge, or discard this patch.
src/Stempler/src/Traverser.php 2 patches
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function __construct(array $visitors = [])
30 30
     {
31
-        foreach ($visitors as $visitor) {
31
+        foreach ($visitors as $visitor){
32 32
             $this->addVisitor($visitor);
33 33
         }
34 34
     }
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 
44 44
     public function removeVisitor(VisitorInterface $visitor): void
45 45
     {
46
-        foreach ($this->visitors as $index => $added) {
47
-            if ($added === $visitor) {
46
+        foreach ($this->visitors as $index => $added){
47
+            if ($added === $visitor){
48 48
                 unset($this->visitors[$index]);
49 49
                 break;
50 50
             }
@@ -63,22 +63,22 @@  discard block
 block discarded – undo
63 63
         $context = $context ?? new VisitorContext();
64 64
 
65 65
         $ctx = clone $context;
66
-        foreach ($nodes as $index => $node) {
67
-            if ($this->stopTraversal) {
66
+        foreach ($nodes as $index => $node){
67
+            if ($this->stopTraversal){
68 68
                 break;
69 69
             }
70 70
 
71 71
             $traverseChildren = true;
72 72
             $breakVisitorID = null;
73 73
 
74
-            if ($node instanceof NodeInterface) {
74
+            if ($node instanceof NodeInterface){
75 75
                 $ctx = $context->withNode($node);
76 76
             }
77 77
 
78
-            foreach ($this->visitors as $visitorID => $visitor) {
78
+            foreach ($this->visitors as $visitorID => $visitor){
79 79
                 $result = $visitor->enterNode($node, $ctx);
80 80
 
81
-                switch (true) {
81
+                switch (true){
82 82
                     case $result === null:
83 83
                         break;
84 84
 
@@ -102,23 +102,23 @@  discard block
 block discarded – undo
102 102
 
103 103
                     default:
104 104
                         throw new \LogicException(
105
-                            'enterNode() returned invalid value of type ' . gettype($result)
105
+                            'enterNode() returned invalid value of type '.gettype($result)
106 106
                         );
107 107
                 }
108 108
             }
109 109
 
110 110
             // sub nodes
111
-            if ($traverseChildren && $node instanceof NodeInterface) {
111
+            if ($traverseChildren && $node instanceof NodeInterface){
112 112
                 $nodes[$index] = $this->traverseNode($node, $ctx);
113
-                if ($this->stopTraversal) {
113
+                if ($this->stopTraversal){
114 114
                     break;
115 115
                 }
116 116
             }
117 117
 
118
-            foreach ($this->visitors as $visitorID => $visitor) {
118
+            foreach ($this->visitors as $visitorID => $visitor){
119 119
                 $result = $visitor->leaveNode($node, $ctx);
120 120
 
121
-                switch (true) {
121
+                switch (true){
122 122
                     case $result === null:
123 123
                         break;
124 124
 
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
 
137 137
                     default:
138 138
                         throw new \LogicException(
139
-                            'leaveNode() returned invalid value of type ' . gettype($result)
139
+                            'leaveNode() returned invalid value of type '.gettype($result)
140 140
                         );
141 141
                 }
142 142
 
143
-                if ($breakVisitorID === $visitorID) {
143
+                if ($breakVisitorID === $visitorID){
144 144
                     break;
145 145
                 }
146 146
             }
@@ -155,18 +155,18 @@  discard block
 block discarded – undo
155 155
     private function traverseNode(NodeInterface $node, VisitorContext $context): NodeInterface
156 156
     {
157 157
         $ctx = clone $context;
158
-        foreach ($node as $name => $_) {
158
+        foreach ($node as $name => $_){
159 159
             $child = &$node->$name;
160
-            if (is_array($child)) {
160
+            if (is_array($child)){
161 161
                 $child = $this->traverse($child, $ctx);
162
-                if ($this->stopTraversal) {
162
+                if ($this->stopTraversal){
163 163
                     break;
164 164
                 }
165 165
 
166 166
                 continue;
167 167
             }
168 168
 
169
-            if (!$child instanceof NodeInterface) {
169
+            if (!$child instanceof NodeInterface){
170 170
                 continue;
171 171
             }
172 172
 
@@ -175,9 +175,9 @@  discard block
 block discarded – undo
175 175
             $traverseChildren = true;
176 176
             $breakVisitorID = null;
177 177
 
178
-            foreach ($this->visitors as $visitorID => $visitor) {
178
+            foreach ($this->visitors as $visitorID => $visitor){
179 179
                 $result = $visitor->enterNode($child, $ctx);
180
-                switch (true) {
180
+                switch (true){
181 181
                     case $result === null:
182 182
                         break;
183 183
 
@@ -200,22 +200,22 @@  discard block
 block discarded – undo
200 200
 
201 201
                     default:
202 202
                         throw new \LogicException(
203
-                            'enterNode() returned invalid value of type ' . gettype($result)
203
+                            'enterNode() returned invalid value of type '.gettype($result)
204 204
                         );
205 205
                 }
206 206
             }
207 207
 
208
-            if ($traverseChildren) {
208
+            if ($traverseChildren){
209 209
                 $child = $this->traverseNode($child, $ctx);
210
-                if ($this->stopTraversal) {
210
+                if ($this->stopTraversal){
211 211
                     break;
212 212
                 }
213 213
             }
214 214
 
215
-            foreach ($this->visitors as $visitorID => $visitor) {
215
+            foreach ($this->visitors as $visitorID => $visitor){
216 216
                 $result = $visitor->leaveNode($child, $ctx);
217 217
 
218
-                switch (true) {
218
+                switch (true){
219 219
                     case $result === null:
220 220
                         break;
221 221
 
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
 
230 230
                     default:
231 231
                         throw new \LogicException(
232
-                            'leaveNode() returned invalid value of type ' . gettype($result)
232
+                            'leaveNode() returned invalid value of type '.gettype($result)
233 233
                         );
234 234
                 }
235 235
 
236
-                if ($breakVisitorID === $visitorID) {
236
+                if ($breakVisitorID === $visitorID){
237 237
                     break;
238 238
                 }
239 239
             }
Please login to merge, or discard this patch.
Braces   +48 added lines, -24 removed lines patch added patch discarded remove patch
@@ -28,7 +28,8 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function __construct(array $visitors = [])
30 30
     {
31
-        foreach ($visitors as $visitor) {
31
+        foreach ($visitors as $visitor)
32
+        {
32 33
             $this->addVisitor($visitor);
33 34
         }
34 35
     }
@@ -43,8 +44,10 @@  discard block
 block discarded – undo
43 44
 
44 45
     public function removeVisitor(VisitorInterface $visitor): void
45 46
     {
46
-        foreach ($this->visitors as $index => $added) {
47
-            if ($added === $visitor) {
47
+        foreach ($this->visitors as $index => $added)
48
+        {
49
+            if ($added === $visitor)
50
+            {
48 51
                 unset($this->visitors[$index]);
49 52
                 break;
50 53
             }
@@ -63,22 +66,27 @@  discard block
 block discarded – undo
63 66
         $context = $context ?? new VisitorContext();
64 67
 
65 68
         $ctx = clone $context;
66
-        foreach ($nodes as $index => $node) {
67
-            if ($this->stopTraversal) {
69
+        foreach ($nodes as $index => $node)
70
+        {
71
+            if ($this->stopTraversal)
72
+            {
68 73
                 break;
69 74
             }
70 75
 
71 76
             $traverseChildren = true;
72 77
             $breakVisitorID = null;
73 78
 
74
-            if ($node instanceof NodeInterface) {
79
+            if ($node instanceof NodeInterface)
80
+            {
75 81
                 $ctx = $context->withNode($node);
76 82
             }
77 83
 
78
-            foreach ($this->visitors as $visitorID => $visitor) {
84
+            foreach ($this->visitors as $visitorID => $visitor)
85
+            {
79 86
                 $result = $visitor->enterNode($node, $ctx);
80 87
 
81
-                switch (true) {
88
+                switch (true)
89
+                {
82 90
                     case $result === null:
83 91
                         break;
84 92
 
@@ -108,17 +116,21 @@  discard block
 block discarded – undo
108 116
             }
109 117
 
110 118
             // sub nodes
111
-            if ($traverseChildren && $node instanceof NodeInterface) {
119
+            if ($traverseChildren && $node instanceof NodeInterface)
120
+            {
112 121
                 $nodes[$index] = $this->traverseNode($node, $ctx);
113
-                if ($this->stopTraversal) {
122
+                if ($this->stopTraversal)
123
+                {
114 124
                     break;
115 125
                 }
116 126
             }
117 127
 
118
-            foreach ($this->visitors as $visitorID => $visitor) {
128
+            foreach ($this->visitors as $visitorID => $visitor)
129
+            {
119 130
                 $result = $visitor->leaveNode($node, $ctx);
120 131
 
121
-                switch (true) {
132
+                switch (true)
133
+                {
122 134
                     case $result === null:
123 135
                         break;
124 136
 
@@ -140,7 +152,8 @@  discard block
 block discarded – undo
140 152
                         );
141 153
                 }
142 154
 
143
-                if ($breakVisitorID === $visitorID) {
155
+                if ($breakVisitorID === $visitorID)
156
+                {
144 157
                     break;
145 158
                 }
146 159
             }
@@ -155,18 +168,22 @@  discard block
 block discarded – undo
155 168
     private function traverseNode(NodeInterface $node, VisitorContext $context): NodeInterface
156 169
     {
157 170
         $ctx = clone $context;
158
-        foreach ($node as $name => $_) {
171
+        foreach ($node as $name => $_)
172
+        {
159 173
             $child = &$node->$name;
160
-            if (is_array($child)) {
174
+            if (is_array($child))
175
+            {
161 176
                 $child = $this->traverse($child, $ctx);
162
-                if ($this->stopTraversal) {
177
+                if ($this->stopTraversal)
178
+                {
163 179
                     break;
164 180
                 }
165 181
 
166 182
                 continue;
167 183
             }
168 184
 
169
-            if (!$child instanceof NodeInterface) {
185
+            if (!$child instanceof NodeInterface)
186
+            {
170 187
                 continue;
171 188
             }
172 189
 
@@ -175,9 +192,11 @@  discard block
 block discarded – undo
175 192
             $traverseChildren = true;
176 193
             $breakVisitorID = null;
177 194
 
178
-            foreach ($this->visitors as $visitorID => $visitor) {
195
+            foreach ($this->visitors as $visitorID => $visitor)
196
+            {
179 197
                 $result = $visitor->enterNode($child, $ctx);
180
-                switch (true) {
198
+                switch (true)
199
+                {
181 200
                     case $result === null:
182 201
                         break;
183 202
 
@@ -205,17 +224,21 @@  discard block
 block discarded – undo
205 224
                 }
206 225
             }
207 226
 
208
-            if ($traverseChildren) {
227
+            if ($traverseChildren)
228
+            {
209 229
                 $child = $this->traverseNode($child, $ctx);
210
-                if ($this->stopTraversal) {
230
+                if ($this->stopTraversal)
231
+                {
211 232
                     break;
212 233
                 }
213 234
             }
214 235
 
215
-            foreach ($this->visitors as $visitorID => $visitor) {
236
+            foreach ($this->visitors as $visitorID => $visitor)
237
+            {
216 238
                 $result = $visitor->leaveNode($child, $ctx);
217 239
 
218
-                switch (true) {
240
+                switch (true)
241
+                {
219 242
                     case $result === null:
220 243
                         break;
221 244
 
@@ -233,7 +256,8 @@  discard block
 block discarded – undo
233 256
                         );
234 257
                 }
235 258
 
236
-                if ($breakVisitorID === $visitorID) {
259
+                if ($breakVisitorID === $visitorID)
260
+                {
237 261
                     break;
238 262
                 }
239 263
             }
Please login to merge, or discard this patch.
src/Stempler/src/Directive/LoopDirective.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
     public function renderBreak(Directive $directive): string
42 42
     {
43
-        if (isset($directive->values[0])) {
43
+        if (isset($directive->values[0])){
44 44
             return sprintf('<?php break %s; ?>', $directive->values[0]);
45 45
         }
46 46
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     public function renderContinue(Directive $directive): string
51 51
     {
52
-        if (isset($directive->values[0])) {
52
+        if (isset($directive->values[0])){
53 53
             return sprintf('<?php continue %s; ?>', $directive->values[0]);
54 54
         }
55 55
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,8 @@  discard block
 block discarded – undo
40 40
 
41 41
     public function renderBreak(Directive $directive): string
42 42
     {
43
-        if (isset($directive->values[0])) {
43
+        if (isset($directive->values[0]))
44
+        {
44 45
             return sprintf('<?php break %s; ?>', $directive->values[0]);
45 46
         }
46 47
 
@@ -49,7 +50,8 @@  discard block
 block discarded – undo
49 50
 
50 51
     public function renderContinue(Directive $directive): string
51 52
     {
52
-        if (isset($directive->values[0])) {
53
+        if (isset($directive->values[0]))
54
+        {
53 55
             return sprintf('<?php continue %s; ?>', $directive->values[0]);
54 56
         }
55 57
 
Please login to merge, or discard this patch.
src/Stempler/src/Directive/AbstractDirective.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,15 +32,15 @@
 block discarded – undo
32 32
 
33 33
     public function hasDirective(string $name): bool
34 34
     {
35
-        return $this->r->hasMethod('render' . ucfirst($name));
35
+        return $this->r->hasMethod('render'.ucfirst($name));
36 36
     }
37 37
 
38 38
     public function render(Directive $directive): ?string
39 39
     {
40
-        if (!$this->hasDirective($directive->name)) {
40
+        if (!$this->hasDirective($directive->name)){
41 41
             return null;
42 42
         }
43 43
 
44
-        return call_user_func([$this, 'render' . ucfirst($directive->name)], $directive);
44
+        return call_user_func([$this, 'render'.ucfirst($directive->name)], $directive);
45 45
     }
46 46
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,8 @@
 block discarded – undo
37 37
 
38 38
     public function render(Directive $directive): ?string
39 39
     {
40
-        if (!$this->hasDirective($directive->name)) {
40
+        if (!$this->hasDirective($directive->name))
41
+        {
41 42
             return null;
42 43
         }
43 44
 
Please login to merge, or discard this patch.
src/Stempler/src/Directive/ConditionalDirective.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
     public function renderCase(Directive $directive): string
82 82
     {
83
-        if ($this->firstSwitchCase) {
83
+        if ($this->firstSwitchCase){
84 84
             $this->firstSwitchCase = false;
85 85
 
86 86
             return sprintf('case (%s): ?>', $directive->body);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
     public function renderDefault(Directive $directive): string
93 93
     {
94
-        if ($this->firstSwitchCase) {
94
+        if ($this->firstSwitchCase){
95 95
             $this->firstSwitchCase = false;
96 96
 
97 97
             return 'default: ?>';
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
     public function renderBreak(Directive $directive): string
109 109
     {
110
-        if (isset($directive->values[0])) {
110
+        if (isset($directive->values[0])){
111 111
             return sprintf('<?php break %s; ?>', $directive->values[0]);
112 112
         }
113 113
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -80,7 +80,8 @@  discard block
 block discarded – undo
80 80
 
81 81
     public function renderCase(Directive $directive): string
82 82
     {
83
-        if ($this->firstSwitchCase) {
83
+        if ($this->firstSwitchCase)
84
+        {
84 85
             $this->firstSwitchCase = false;
85 86
 
86 87
             return sprintf('case (%s): ?>', $directive->body);
@@ -91,7 +92,8 @@  discard block
 block discarded – undo
91 92
 
92 93
     public function renderDefault(Directive $directive): string
93 94
     {
94
-        if ($this->firstSwitchCase) {
95
+        if ($this->firstSwitchCase)
96
+        {
95 97
             $this->firstSwitchCase = false;
96 98
 
97 99
             return 'default: ?>';
@@ -107,7 +109,8 @@  discard block
 block discarded – undo
107 109
 
108 110
     public function renderBreak(Directive $directive): string
109 111
     {
110
-        if (isset($directive->values[0])) {
112
+        if (isset($directive->values[0]))
113
+        {
111 114
             return sprintf('<?php break %s; ?>', $directive->values[0]);
112 115
         }
113 116
 
Please login to merge, or discard this patch.
src/Stempler/src/Directive/DirectiveGroup.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function hasDirective(string $name): bool
35 35
     {
36
-        foreach ($this->directives as $directiveRenderer) {
37
-            if ($directiveRenderer->hasDirective($name)) {
36
+        foreach ($this->directives as $directiveRenderer){
37
+            if ($directiveRenderer->hasDirective($name)){
38 38
                 return true;
39 39
             }
40 40
         }
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 
45 45
     public function render(Directive $directive): ?string
46 46
     {
47
-        foreach ($this->directives as $directiveRenderer) {
48
-            if ($directiveRenderer->hasDirective($directive->name)) {
47
+        foreach ($this->directives as $directiveRenderer){
48
+            if ($directiveRenderer->hasDirective($directive->name)){
49 49
                 return $directiveRenderer->render($directive);
50 50
             }
51 51
         }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,8 +33,10 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function hasDirective(string $name): bool
35 35
     {
36
-        foreach ($this->directives as $directiveRenderer) {
37
-            if ($directiveRenderer->hasDirective($name)) {
36
+        foreach ($this->directives as $directiveRenderer)
37
+        {
38
+            if ($directiveRenderer->hasDirective($name))
39
+            {
38 40
                 return true;
39 41
             }
40 42
         }
@@ -44,8 +46,10 @@  discard block
 block discarded – undo
44 46
 
45 47
     public function render(Directive $directive): ?string
46 48
     {
47
-        foreach ($this->directives as $directiveRenderer) {
48
-            if ($directiveRenderer->hasDirective($directive->name)) {
49
+        foreach ($this->directives as $directiveRenderer)
50
+        {
51
+            if ($directiveRenderer->hasDirective($directive->name))
52
+            {
49 53
                 return $directiveRenderer->render($directive);
50 54
             }
51 55
         }
Please login to merge, or discard this patch.
src/Stempler/src/Compiler/Result.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,15 +33,15 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function withinContext(?Context $ctx, callable $body): void
35 35
     {
36
-        if ($ctx === null || $ctx->getPath() === null) {
36
+        if ($ctx === null || $ctx->getPath() === null){
37 37
             $body($this);
38 38
             return;
39 39
         }
40 40
 
41
-        try {
41
+        try{
42 42
             $this->parent = Location::fromContext($ctx, $this->parent);
43 43
             $body($this);
44
-        } finally {
44
+        }finally{
45 45
             $this->parent = $this->parent->parent;
46 46
         }
47 47
     }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function push(string $content, Context $ctx = null): void
53 53
     {
54
-        if ($ctx !== null && $ctx->getPath() !== null) {
54
+        if ($ctx !== null && $ctx->getPath() !== null){
55 55
             $this->locations[strlen($this->content)] = Location::fromContext($ctx, $this->parent);
56 56
         }
57 57
 
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
         $paths = [];
72 72
 
73 73
         // We can scan top level only
74
-        foreach ($this->locations as $loc) {
75
-            if (!in_array($loc->path, $paths, true)) {
74
+        foreach ($this->locations as $loc){
75
+            if (!in_array($loc->path, $paths, true)){
76 76
                 $paths[] = $loc->path;
77 77
             }
78 78
         }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     {
88 88
         $locations = [];
89 89
 
90
-        foreach ($this->locations as $offset => $location) {
90
+        foreach ($this->locations as $offset => $location){
91 91
             $locations[$offset] = $location;
92 92
         }
93 93
 
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,15 +33,19 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function withinContext(?Context $ctx, callable $body): void
35 35
     {
36
-        if ($ctx === null || $ctx->getPath() === null) {
36
+        if ($ctx === null || $ctx->getPath() === null)
37
+        {
37 38
             $body($this);
38 39
             return;
39 40
         }
40 41
 
41
-        try {
42
+        try
43
+        {
42 44
             $this->parent = Location::fromContext($ctx, $this->parent);
43 45
             $body($this);
44
-        } finally {
46
+        }
47
+        finally
48
+        {
45 49
             $this->parent = $this->parent->parent;
46 50
         }
47 51
     }
@@ -51,7 +55,8 @@  discard block
 block discarded – undo
51 55
      */
52 56
     public function push(string $content, Context $ctx = null): void
53 57
     {
54
-        if ($ctx !== null && $ctx->getPath() !== null) {
58
+        if ($ctx !== null && $ctx->getPath() !== null)
59
+        {
55 60
             $this->locations[strlen($this->content)] = Location::fromContext($ctx, $this->parent);
56 61
         }
57 62
 
@@ -71,8 +76,10 @@  discard block
 block discarded – undo
71 76
         $paths = [];
72 77
 
73 78
         // We can scan top level only
74
-        foreach ($this->locations as $loc) {
75
-            if (!in_array($loc->path, $paths, true)) {
79
+        foreach ($this->locations as $loc)
80
+        {
81
+            if (!in_array($loc->path, $paths, true))
82
+            {
76 83
                 $paths[] = $loc->path;
77 84
             }
78 85
         }
@@ -87,7 +94,8 @@  discard block
 block discarded – undo
87 94
     {
88 95
         $locations = [];
89 96
 
90
-        foreach ($this->locations as $offset => $location) {
97
+        foreach ($this->locations as $offset => $location)
98
+        {
91 99
             $locations[$offset] = $location;
92 100
         }
93 101
 
Please login to merge, or discard this patch.
src/Stempler/src/Compiler/SourceMap.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
     {
50 50
         $paths = [];
51 51
 
52
-        foreach ($this->lines as $line) {
53
-            if (!in_array($this->paths[$line[0]], $paths, true)) {
52
+        foreach ($this->lines as $line){
53
+            if (!in_array($this->paths[$line[0]], $paths, true)){
54 54
                 $paths[] = $this->paths[$line[0]];
55 55
             }
56 56
         }
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
     public function getStack(int $line): array
66 66
     {
67 67
         $found = null;
68
-        foreach ($this->lines as $linen => $ctx) {
69
-            if ($linen <= $line) {
68
+        foreach ($this->lines as $linen => $ctx){
69
+            if ($linen <= $line){
70 70
                 $found = $ctx;
71 71
             }
72 72
         }
73 73
 
74
-        if ($found === null) {
74
+        if ($found === null){
75 75
             return [];
76 76
         }
77 77
 
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
     {
104 104
         $map = new self();
105 105
 
106
-        foreach ($locations as $offset => $location) {
106
+        foreach ($locations as $offset => $location){
107 107
             $line = Source::resolveLine($content, $offset);
108
-            if (!isset($map->lines[$line])) {
108
+            if (!isset($map->lines[$line])){
109 109
                 $map->lines[$line] = $map->calculateLine($location, $loader);
110 110
             }
111 111
         }
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
             'line' => $line[1],
123 123
         ];
124 124
 
125
-        if ($line[2] !== null) {
125
+        if ($line[2] !== null){
126 126
             $this->unpack($result, $line[2]);
127 127
         }
128 128
     }
129 129
 
130 130
     private function calculateLine(Location $location, LoaderInterface $loader): array
131 131
     {
132
-        if (!isset($this->sourceCache[$location->path])) {
132
+        if (!isset($this->sourceCache[$location->path])){
133 133
             $this->sourceCache[$location->path] = $loader->load($location->path);
134 134
         }
135 135
         $path = $this->sourceCache[$location->path]->getFilename();
136 136
 
137
-        if (!in_array($path, $this->paths, true)) {
137
+        if (!in_array($path, $this->paths, true)){
138 138
             $this->paths[] = $path;
139 139
         }
140 140
 
Please login to merge, or discard this patch.
Braces   +20 added lines, -10 removed lines patch added patch discarded remove patch
@@ -49,8 +49,10 @@  discard block
 block discarded – undo
49 49
     {
50 50
         $paths = [];
51 51
 
52
-        foreach ($this->lines as $line) {
53
-            if (!in_array($this->paths[$line[0]], $paths, true)) {
52
+        foreach ($this->lines as $line)
53
+        {
54
+            if (!in_array($this->paths[$line[0]], $paths, true))
55
+            {
54 56
                 $paths[] = $this->paths[$line[0]];
55 57
             }
56 58
         }
@@ -65,13 +67,16 @@  discard block
 block discarded – undo
65 67
     public function getStack(int $line): array
66 68
     {
67 69
         $found = null;
68
-        foreach ($this->lines as $linen => $ctx) {
69
-            if ($linen <= $line) {
70
+        foreach ($this->lines as $linen => $ctx)
71
+        {
72
+            if ($linen <= $line)
73
+            {
70 74
                 $found = $ctx;
71 75
             }
72 76
         }
73 77
 
74
-        if ($found === null) {
78
+        if ($found === null)
79
+        {
75 80
             return [];
76 81
         }
77 82
 
@@ -103,9 +108,11 @@  discard block
 block discarded – undo
103 108
     {
104 109
         $map = new self();
105 110
 
106
-        foreach ($locations as $offset => $location) {
111
+        foreach ($locations as $offset => $location)
112
+        {
107 113
             $line = Source::resolveLine($content, $offset);
108
-            if (!isset($map->lines[$line])) {
114
+            if (!isset($map->lines[$line]))
115
+            {
109 116
                 $map->lines[$line] = $map->calculateLine($location, $loader);
110 117
             }
111 118
         }
@@ -122,19 +129,22 @@  discard block
 block discarded – undo
122 129
             'line' => $line[1],
123 130
         ];
124 131
 
125
-        if ($line[2] !== null) {
132
+        if ($line[2] !== null)
133
+        {
126 134
             $this->unpack($result, $line[2]);
127 135
         }
128 136
     }
129 137
 
130 138
     private function calculateLine(Location $location, LoaderInterface $loader): array
131 139
     {
132
-        if (!isset($this->sourceCache[$location->path])) {
140
+        if (!isset($this->sourceCache[$location->path]))
141
+        {
133 142
             $this->sourceCache[$location->path] = $loader->load($location->path);
134 143
         }
135 144
         $path = $this->sourceCache[$location->path]->getFilename();
136 145
 
137
-        if (!in_array($path, $this->paths, true)) {
146
+        if (!in_array($path, $this->paths, true))
147
+        {
138 148
             $this->paths[] = $path;
139 149
         }
140 150
 
Please login to merge, or discard this patch.