Passed
Pull Request — master (#370)
by Valentin
04:51
created
src/StemplerBridge/src/StemplerLoader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
      */
57 57
     public function load(string $path): Source
58 58
     {
59
-        if ($this->context === null) {
59
+        if ($this->context === null){
60 60
             throw new EngineException('Unable to use StemplerLoader without given context.');
61 61
         }
62 62
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,8 @@
 block discarded – undo
56 56
      */
57 57
     public function load(string $path): Source
58 58
     {
59
-        if ($this->context === null) {
59
+        if ($this->context === null)
60
+        {
60 61
             throw new EngineException('Unable to use StemplerLoader without given context.');
61 62
         }
62 63
 
Please login to merge, or discard this patch.
src/StemplerBridge/src/ExceptionMapper.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
         $classFilename = (new \ReflectionClass($class))->getFileName();
46 46
 
47 47
         // looking for proper view error location
48
-        if ($e->getFile() !== $classFilename) {
49
-            foreach ($e->getTrace() as $trace) {
50
-                if (isset($trace['file']) && $trace['file'] === $classFilename) {
48
+        if ($e->getFile() !== $classFilename){
49
+            foreach ($e->getTrace() as $trace){
50
+                if (isset($trace['file']) && $trace['file'] === $classFilename){
51 51
                     $line = $trace['line'];
52 52
                     break;
53 53
                 }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         }
56 56
 
57 57
         $userStack = [];
58
-        foreach ($this->sourcemap->getStack($line - $this->lineOffset) as $stack) {
58
+        foreach ($this->sourcemap->getStack($line - $this->lineOffset) as $stack){
59 59
             $userStack[] = [
60 60
                 'file'     => $stack['file'],
61 61
                 'line'     => $stack['line'],
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
                 'args'     => [$data],
66 66
             ];
67 67
 
68
-            if ($stack['file'] === $filename) {
68
+            if ($stack['file'] === $filename){
69 69
                 // no need to jump over root template
70 70
                 break;
71 71
             }
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,9 +45,12 @@  discard block
 block discarded – undo
45 45
         $classFilename = (new \ReflectionClass($class))->getFileName();
46 46
 
47 47
         // looking for proper view error location
48
-        if ($e->getFile() !== $classFilename) {
49
-            foreach ($e->getTrace() as $trace) {
50
-                if (isset($trace['file']) && $trace['file'] === $classFilename) {
48
+        if ($e->getFile() !== $classFilename)
49
+        {
50
+            foreach ($e->getTrace() as $trace)
51
+            {
52
+                if (isset($trace['file']) && $trace['file'] === $classFilename)
53
+                {
51 54
                     $line = $trace['line'];
52 55
                     break;
53 56
                 }
@@ -55,7 +58,8 @@  discard block
 block discarded – undo
55 58
         }
56 59
 
57 60
         $userStack = [];
58
-        foreach ($this->sourcemap->getStack($line - $this->lineOffset) as $stack) {
61
+        foreach ($this->sourcemap->getStack($line - $this->lineOffset) as $stack)
62
+        {
59 63
             $userStack[] = [
60 64
                 'file'     => $stack['file'],
61 65
                 'line'     => $stack['line'],
@@ -65,7 +69,8 @@  discard block
 block discarded – undo
65 69
                 'args'     => [$data],
66 70
             ];
67 71
 
68
-            if ($stack['file'] === $filename) {
72
+            if ($stack['file'] === $filename)
73
+            {
69 74
                 // no need to jump over root template
70 75
                 break;
71 76
             }
Please login to merge, or discard this patch.
src/StemplerBridge/src/StemplerCache.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
67 67
     public function isFresh(string $key): bool
68 68
     {
69 69
         $mapFilename = $this->mapFilename($key);
70
-        if (!$this->files->exists($mapFilename)) {
70
+        if (!$this->files->exists($mapFilename)){
71 71
             return false;
72 72
         }
73 73
 
74 74
         $time = $this->files->time($this->filename($key));
75 75
 
76 76
         $files = (array)include $mapFilename;
77
-        foreach ($files as $file) {
78
-            if ($this->files->time($file) > $time) {
77
+        foreach ($files as $file){
78
+            if ($this->files->time($file) > $time){
79 79
                 // some partial has changed
80 80
                 return false;
81 81
             }
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
     public function delete(string $key): void
93 93
     {
94 94
         $filename = $this->filename($key);
95
-        if ($this->files->exists($filename)) {
95
+        if ($this->files->exists($filename)){
96 96
             $this->files->delete($filename);
97 97
         }
98 98
 
99 99
         $mapFilename = $this->mapFilename($key);
100
-        if ($this->files->exists($mapFilename)) {
100
+        if ($this->files->exists($mapFilename)){
101 101
             $this->files->delete($mapFilename);
102 102
         }
103 103
     }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     public function load(string $key): void
111 111
     {
112 112
         $filename = $this->filename($key);
113
-        if ($this->files->exists($filename)) {
113
+        if ($this->files->exists($filename)){
114 114
             include_once $filename;
115 115
         }
116 116
     }
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,15 +67,18 @@  discard block
 block discarded – undo
67 67
     public function isFresh(string $key): bool
68 68
     {
69 69
         $mapFilename = $this->mapFilename($key);
70
-        if (!$this->files->exists($mapFilename)) {
70
+        if (!$this->files->exists($mapFilename))
71
+        {
71 72
             return false;
72 73
         }
73 74
 
74 75
         $time = $this->files->time($this->filename($key));
75 76
 
76 77
         $files = (array)include $mapFilename;
77
-        foreach ($files as $file) {
78
-            if ($this->files->time($file) > $time) {
78
+        foreach ($files as $file)
79
+        {
80
+            if ($this->files->time($file) > $time)
81
+            {
79 82
                 // some partial has changed
80 83
                 return false;
81 84
             }
@@ -92,12 +95,14 @@  discard block
 block discarded – undo
92 95
     public function delete(string $key): void
93 96
     {
94 97
         $filename = $this->filename($key);
95
-        if ($this->files->exists($filename)) {
98
+        if ($this->files->exists($filename))
99
+        {
96 100
             $this->files->delete($filename);
97 101
         }
98 102
 
99 103
         $mapFilename = $this->mapFilename($key);
100
-        if ($this->files->exists($mapFilename)) {
104
+        if ($this->files->exists($mapFilename))
105
+        {
101 106
             $this->files->delete($mapFilename);
102 107
         }
103 108
     }
@@ -110,7 +115,8 @@  discard block
 block discarded – undo
110 115
     public function load(string $key): void
111 116
     {
112 117
         $filename = $this->filename($key);
113
-        if ($this->files->exists($filename)) {
118
+        if ($this->files->exists($filename))
119
+        {
114 120
             include_once $filename;
115 121
         }
116 122
     }
Please login to merge, or discard this patch.
src/StemplerBridge/src/StemplerView.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
             $this->context
60 60
         );
61 61
 
62
-        if ($sourcemap === null) {
62
+        if ($sourcemap === null){
63 63
             return $e;
64 64
         }
65 65
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,8 @@
 block discarded – undo
59 59
             $this->context
60 60
         );
61 61
 
62
-        if ($sourcemap === null) {
62
+        if ($sourcemap === null)
63
+        {
63 64
             return $e;
64 65
         }
65 66
 
Please login to merge, or discard this patch.
src/StemplerBridge/src/StemplerEngine.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         ContainerInterface $container,
71 71
         StemplerConfig $config,
72 72
         StemplerCache $cache = null
73
-    ) {
73
+    ){
74 74
         $this->container = $container;
75 75
         $this->config = $config;
76 76
         $this->cache = $cache;
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      */
102 102
     public function getLoader(): LoaderInterface
103 103
     {
104
-        if ($this->loader === null) {
104
+        if ($this->loader === null){
105 105
             throw new EngineException('No associated loader found');
106 106
         }
107 107
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public function getBuilder(ContextInterface $context): Builder
118 118
     {
119
-        if ($this->builder === null) {
119
+        if ($this->builder === null){
120 120
             throw new EngineException('No associated builder found');
121 121
         }
122 122
 
@@ -140,25 +140,25 @@  discard block
 block discarded – undo
140 140
         // cache key
141 141
         $key = $this->cacheKey($view, $context);
142 142
 
143
-        if ($this->cache !== null && $this->cache->isFresh($key)) {
143
+        if ($this->cache !== null && $this->cache->isFresh($key)){
144 144
             $this->cache->load($key);
145
-        } elseif (!class_exists($class)) {
146
-            try {
145
+        } elseif (!class_exists($class)){
146
+            try{
147 147
                 $builder = $this->getBuilder($context);
148 148
 
149 149
                 $result = $builder->compile($path);
150
-            } catch (Throwable $e) {
150
+            }catch (Throwable $e){
151 151
                 throw new CompileException($e);
152 152
             }
153 153
 
154 154
             $compiled = $this->compileClass($class, $result);
155 155
 
156
-            if ($this->cache !== null) {
156
+            if ($this->cache !== null){
157 157
                 $this->cache->write(
158 158
                     $key,
159 159
                     $compiled,
160 160
                     array_map(
161
-                        function ($path) {
161
+                        function ($path){
162 162
                             return $this->getLoader()->load($path)->getFilename();
163 163
                         },
164 164
                         $result->getPaths()
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
                 $this->cache->load($key);
169 169
             }
170 170
 
171
-            if (!class_exists($class)) {
171
+            if (!class_exists($class)){
172 172
                 // runtime initialization
173
-                eval('?>' . $compiled);
173
+                eval('?>'.$compiled);
174 174
             }
175 175
         }
176 176
 
177
-        if (!class_exists($class)) {
177
+        if (!class_exists($class)){
178 178
             throw new EngineException("Unable to load `{$path}`, cache might be corrupted");
179 179
         }
180 180
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      */
187 187
     public function reset(string $path, ContextInterface $context): void
188 188
     {
189
-        if ($this->cache === null) {
189
+        if ($this->cache === null){
190 190
             return;
191 191
         }
192 192
 
@@ -212,12 +212,12 @@  discard block
 block discarded – undo
212 212
      */
213 213
     public function makeSourceMap(string $path, ContextInterface $context): ?SourceMap
214 214
     {
215
-        try {
215
+        try{
216 216
             $builder = $this->getBuilder($context);
217 217
 
218 218
             // there is no need to cache sourcemaps since they are used during the exception only
219 219
             return $builder->compile($path)->getSourceMap($builder->getLoader());
220
-        } catch (Throwable $e) {
220
+        }catch (Throwable $e){
221 221
             return null;
222 222
         }
223 223
     }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
      */
261 261
     private function className(ViewSource $source, ContextInterface $context): string
262 262
     {
263
-        return $this->classPrefix . $this->cacheKey($source, $context);
263
+        return $this->classPrefix.$this->cacheKey($source, $context);
264 264
     }
265 265
 
266 266
     /**
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
         $builder = new Builder($loader);
290 290
 
291 291
         $directivesGroup = new DirectiveGroup();
292
-        foreach ($this->getDirectives() as $directive) {
292
+        foreach ($this->getDirectives() as $directive){
293 293
             $directivesGroup->addDirective($directive);
294 294
         }
295 295
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         $builder->getCompiler()->addRenderer(new DynamicRenderer(new DirectiveGroup($this->getDirectives())));
321 321
 
322 322
         // ATS modifications
323
-        foreach ($this->getVisitors(Builder::STAGE_PREPARE) as $visitor) {
323
+        foreach ($this->getVisitors(Builder::STAGE_PREPARE) as $visitor){
324 324
             $builder->addVisitor($visitor, Builder::STAGE_PREPARE);
325 325
         }
326 326
 
@@ -333,15 +333,15 @@  discard block
 block discarded – undo
333 333
         $builder->addVisitor(new ResolveImports($builder), Builder::STAGE_TRANSFORM);
334 334
         $builder->addVisitor(new ExtendsParent($builder), Builder::STAGE_TRANSFORM);
335 335
 
336
-        foreach ($this->getVisitors(Builder::STAGE_TRANSFORM) as $visitor) {
336
+        foreach ($this->getVisitors(Builder::STAGE_TRANSFORM) as $visitor){
337 337
             $builder->addVisitor($visitor, Builder::STAGE_TRANSFORM);
338 338
         }
339 339
 
340
-        foreach ($this->getVisitors(Builder::STAGE_FINALIZE) as $visitor) {
340
+        foreach ($this->getVisitors(Builder::STAGE_FINALIZE) as $visitor){
341 341
             $builder->addVisitor($visitor, Builder::STAGE_FINALIZE);
342 342
         }
343 343
 
344
-        foreach ($this->getVisitors(Builder::STAGE_COMPILE) as $visitor) {
344
+        foreach ($this->getVisitors(Builder::STAGE_COMPILE) as $visitor){
345 345
             $builder->addVisitor($visitor, Builder::STAGE_COMPILE);
346 346
         }
347 347
 
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
     private function getVisitors(int $stage): iterable
356 356
     {
357 357
         $result = [];
358
-        foreach ($this->config->getVisitors($stage) as $visitor) {
359
-            if ($visitor instanceof Autowire) {
358
+        foreach ($this->config->getVisitors($stage) as $visitor){
359
+            if ($visitor instanceof Autowire){
360 360
                 $result[] = $visitor->resolve($this->container->get(FactoryInterface::class));
361 361
                 continue;
362 362
             }
@@ -373,8 +373,8 @@  discard block
 block discarded – undo
373 373
     private function getProcessors(): iterable
374 374
     {
375 375
         $result = [];
376
-        foreach ($this->config->getProcessors() as $processor) {
377
-            if ($processor instanceof Autowire) {
376
+        foreach ($this->config->getProcessors() as $processor){
377
+            if ($processor instanceof Autowire){
378 378
                 $result[] = $processor->resolve($this->container->get(FactoryInterface::class));
379 379
                 continue;
380 380
             }
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
     private function getDirectives(): iterable
392 392
     {
393 393
         $result = [];
394
-        foreach ($this->config->getDirectives() as $directive) {
395
-            if ($directive instanceof Autowire) {
394
+        foreach ($this->config->getDirectives() as $directive){
395
+            if ($directive instanceof Autowire){
396 396
                 $result[] = $directive->resolve($this->container->get(FactoryInterface::class));
397 397
                 continue;
398 398
             }
Please login to merge, or discard this patch.
Braces   +51 added lines, -24 removed lines patch added patch discarded remove patch
@@ -101,7 +101,8 @@  discard block
 block discarded – undo
101 101
      */
102 102
     public function getLoader(): LoaderInterface
103 103
     {
104
-        if ($this->loader === null) {
104
+        if ($this->loader === null)
105
+        {
105 106
             throw new EngineException('No associated loader found');
106 107
         }
107 108
 
@@ -116,7 +117,8 @@  discard block
 block discarded – undo
116 117
      */
117 118
     public function getBuilder(ContextInterface $context): Builder
118 119
     {
119
-        if ($this->builder === null) {
120
+        if ($this->builder === null)
121
+        {
120 122
             throw new EngineException('No associated builder found');
121 123
         }
122 124
 
@@ -140,25 +142,33 @@  discard block
 block discarded – undo
140 142
         // cache key
141 143
         $key = $this->cacheKey($view, $context);
142 144
 
143
-        if ($this->cache !== null && $this->cache->isFresh($key)) {
145
+        if ($this->cache !== null && $this->cache->isFresh($key))
146
+        {
144 147
             $this->cache->load($key);
145
-        } elseif (!class_exists($class)) {
146
-            try {
148
+        }
149
+        elseif (!class_exists($class))
150
+        {
151
+            try
152
+            {
147 153
                 $builder = $this->getBuilder($context);
148 154
 
149 155
                 $result = $builder->compile($path);
150
-            } catch (Throwable $e) {
156
+            }
157
+            catch (Throwable $e)
158
+            {
151 159
                 throw new CompileException($e);
152 160
             }
153 161
 
154 162
             $compiled = $this->compileClass($class, $result);
155 163
 
156
-            if ($this->cache !== null) {
164
+            if ($this->cache !== null)
165
+            {
157 166
                 $this->cache->write(
158 167
                     $key,
159 168
                     $compiled,
160 169
                     array_map(
161
-                        function ($path) {
170
+                        function ($path)
171
+                        {
162 172
                             return $this->getLoader()->load($path)->getFilename();
163 173
                         },
164 174
                         $result->getPaths()
@@ -168,13 +178,15 @@  discard block
 block discarded – undo
168 178
                 $this->cache->load($key);
169 179
             }
170 180
 
171
-            if (!class_exists($class)) {
181
+            if (!class_exists($class))
182
+            {
172 183
                 // runtime initialization
173 184
                 eval('?>' . $compiled);
174 185
             }
175 186
         }
176 187
 
177
-        if (!class_exists($class)) {
188
+        if (!class_exists($class))
189
+        {
178 190
             throw new EngineException("Unable to load `{$path}`, cache might be corrupted");
179 191
         }
180 192
 
@@ -186,7 +198,8 @@  discard block
 block discarded – undo
186 198
      */
187 199
     public function reset(string $path, ContextInterface $context): void
188 200
     {
189
-        if ($this->cache === null) {
201
+        if ($this->cache === null)
202
+        {
190 203
             return;
191 204
         }
192 205
 
@@ -212,12 +225,15 @@  discard block
 block discarded – undo
212 225
      */
213 226
     public function makeSourceMap(string $path, ContextInterface $context): ?SourceMap
214 227
     {
215
-        try {
228
+        try
229
+        {
216 230
             $builder = $this->getBuilder($context);
217 231
 
218 232
             // there is no need to cache sourcemaps since they are used during the exception only
219 233
             return $builder->compile($path)->getSourceMap($builder->getLoader());
220
-        } catch (Throwable $e) {
234
+        }
235
+        catch (Throwable $e)
236
+        {
221 237
             return null;
222 238
         }
223 239
     }
@@ -289,7 +305,8 @@  discard block
 block discarded – undo
289 305
         $builder = new Builder($loader);
290 306
 
291 307
         $directivesGroup = new DirectiveGroup();
292
-        foreach ($this->getDirectives() as $directive) {
308
+        foreach ($this->getDirectives() as $directive)
309
+        {
293 310
             $directivesGroup->addDirective($directive);
294 311
         }
295 312
 
@@ -320,7 +337,8 @@  discard block
 block discarded – undo
320 337
         $builder->getCompiler()->addRenderer(new DynamicRenderer(new DirectiveGroup($this->getDirectives())));
321 338
 
322 339
         // ATS modifications
323
-        foreach ($this->getVisitors(Builder::STAGE_PREPARE) as $visitor) {
340
+        foreach ($this->getVisitors(Builder::STAGE_PREPARE) as $visitor)
341
+        {
324 342
             $builder->addVisitor($visitor, Builder::STAGE_PREPARE);
325 343
         }
326 344
 
@@ -333,15 +351,18 @@  discard block
 block discarded – undo
333 351
         $builder->addVisitor(new ResolveImports($builder), Builder::STAGE_TRANSFORM);
334 352
         $builder->addVisitor(new ExtendsParent($builder), Builder::STAGE_TRANSFORM);
335 353
 
336
-        foreach ($this->getVisitors(Builder::STAGE_TRANSFORM) as $visitor) {
354
+        foreach ($this->getVisitors(Builder::STAGE_TRANSFORM) as $visitor)
355
+        {
337 356
             $builder->addVisitor($visitor, Builder::STAGE_TRANSFORM);
338 357
         }
339 358
 
340
-        foreach ($this->getVisitors(Builder::STAGE_FINALIZE) as $visitor) {
359
+        foreach ($this->getVisitors(Builder::STAGE_FINALIZE) as $visitor)
360
+        {
341 361
             $builder->addVisitor($visitor, Builder::STAGE_FINALIZE);
342 362
         }
343 363
 
344
-        foreach ($this->getVisitors(Builder::STAGE_COMPILE) as $visitor) {
364
+        foreach ($this->getVisitors(Builder::STAGE_COMPILE) as $visitor)
365
+        {
345 366
             $builder->addVisitor($visitor, Builder::STAGE_COMPILE);
346 367
         }
347 368
 
@@ -355,8 +376,10 @@  discard block
 block discarded – undo
355 376
     private function getVisitors(int $stage): iterable
356 377
     {
357 378
         $result = [];
358
-        foreach ($this->config->getVisitors($stage) as $visitor) {
359
-            if ($visitor instanceof Autowire) {
379
+        foreach ($this->config->getVisitors($stage) as $visitor)
380
+        {
381
+            if ($visitor instanceof Autowire)
382
+            {
360 383
                 $result[] = $visitor->resolve($this->container->get(FactoryInterface::class));
361 384
                 continue;
362 385
             }
@@ -373,8 +396,10 @@  discard block
 block discarded – undo
373 396
     private function getProcessors(): iterable
374 397
     {
375 398
         $result = [];
376
-        foreach ($this->config->getProcessors() as $processor) {
377
-            if ($processor instanceof Autowire) {
399
+        foreach ($this->config->getProcessors() as $processor)
400
+        {
401
+            if ($processor instanceof Autowire)
402
+            {
378 403
                 $result[] = $processor->resolve($this->container->get(FactoryInterface::class));
379 404
                 continue;
380 405
             }
@@ -391,8 +416,10 @@  discard block
 block discarded – undo
391 416
     private function getDirectives(): iterable
392 417
     {
393 418
         $result = [];
394
-        foreach ($this->config->getDirectives() as $directive) {
395
-            if ($directive instanceof Autowire) {
419
+        foreach ($this->config->getDirectives() as $directive)
420
+        {
421
+            if ($directive instanceof Autowire)
422
+            {
396 423
                 $result[] = $directive->resolve($this->container->get(FactoryInterface::class));
397 424
                 continue;
398 425
             }
Please login to merge, or discard this patch.
src/StemplerBridge/src/Config/StemplerConfig.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
     public function getDirectives(): array
33 33
     {
34 34
         $directives = [];
35
-        foreach ($this->config['directives'] as $directive) {
36
-            if (is_object($directive) && !$directive instanceof Autowire) {
35
+        foreach ($this->config['directives'] as $directive){
36
+            if (is_object($directive) && !$directive instanceof Autowire){
37 37
                 $directives[] = $directive;
38 38
                 continue;
39 39
             }
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
     public function getProcessors(): array
51 51
     {
52 52
         $processors = [];
53
-        foreach ($this->config['processors'] as $processor) {
54
-            if (is_object($processor) && !$processor instanceof Autowire) {
53
+        foreach ($this->config['processors'] as $processor){
54
+            if (is_object($processor) && !$processor instanceof Autowire){
55 55
                 $processors[] = $processor;
56 56
                 continue;
57 57
             }
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
     public function getVisitors(int $stage): array
70 70
     {
71 71
         $visitors = [];
72
-        foreach ($this->config['visitors'][$stage] ?? [] as $visitor) {
73
-            if (is_object($visitor) && !$visitor instanceof Autowire) {
72
+        foreach ($this->config['visitors'][$stage] ?? [] as $visitor){
73
+            if (is_object($visitor) && !$visitor instanceof Autowire){
74 74
                 $visitors[] = $visitor;
75 75
                 continue;
76 76
             }
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
      */
90 90
     private function wire($item): Autowire
91 91
     {
92
-        if ($item instanceof Autowire) {
92
+        if ($item instanceof Autowire){
93 93
             return $item;
94 94
         }
95 95
 
96
-        if (is_string($item)) {
96
+        if (is_string($item)){
97 97
             return new Autowire($item);
98 98
         }
99 99
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,8 +32,10 @@  discard block
 block discarded – undo
32 32
     public function getDirectives(): array
33 33
     {
34 34
         $directives = [];
35
-        foreach ($this->config['directives'] as $directive) {
36
-            if (is_object($directive) && !$directive instanceof Autowire) {
35
+        foreach ($this->config['directives'] as $directive)
36
+        {
37
+            if (is_object($directive) && !$directive instanceof Autowire)
38
+            {
37 39
                 $directives[] = $directive;
38 40
                 continue;
39 41
             }
@@ -50,8 +52,10 @@  discard block
 block discarded – undo
50 52
     public function getProcessors(): array
51 53
     {
52 54
         $processors = [];
53
-        foreach ($this->config['processors'] as $processor) {
54
-            if (is_object($processor) && !$processor instanceof Autowire) {
55
+        foreach ($this->config['processors'] as $processor)
56
+        {
57
+            if (is_object($processor) && !$processor instanceof Autowire)
58
+            {
55 59
                 $processors[] = $processor;
56 60
                 continue;
57 61
             }
@@ -69,8 +73,10 @@  discard block
 block discarded – undo
69 73
     public function getVisitors(int $stage): array
70 74
     {
71 75
         $visitors = [];
72
-        foreach ($this->config['visitors'][$stage] ?? [] as $visitor) {
73
-            if (is_object($visitor) && !$visitor instanceof Autowire) {
76
+        foreach ($this->config['visitors'][$stage] ?? [] as $visitor)
77
+        {
78
+            if (is_object($visitor) && !$visitor instanceof Autowire)
79
+            {
74 80
                 $visitors[] = $visitor;
75 81
                 continue;
76 82
             }
@@ -89,11 +95,13 @@  discard block
 block discarded – undo
89 95
      */
90 96
     private function wire($item): Autowire
91 97
     {
92
-        if ($item instanceof Autowire) {
98
+        if ($item instanceof Autowire)
99
+        {
93 100
             return $item;
94 101
         }
95 102
 
96
-        if (is_string($item)) {
103
+        if (is_string($item))
104
+        {
97 105
             return new Autowire($item);
98 106
         }
99 107
 
Please login to merge, or discard this patch.
src/StemplerBridge/src/Bootloader/StemplerBootloader.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
         $views->addEngine(StemplerEngine::class);
97 97
 
98
-        if ($container->has(LocaleProcessor::class)) {
98
+        if ($container->has(LocaleProcessor::class)){
99 99
             $this->addProcessor(LocaleProcessor::class);
100 100
         }
101 101
     }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     {
131 131
         $this->config->modify(
132 132
             'views/stempler',
133
-            new Append('visitors.' . (string)$stage, null, $visitor)
133
+            new Append('visitors.'.(string)$stage, null, $visitor)
134 134
         );
135 135
     }
136 136
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         ViewsConfig $viewConfig
147 147
     ): StemplerEngine {
148 148
         $cache = null;
149
-        if ($viewConfig->isCacheEnabled()) {
149
+        if ($viewConfig->isCacheEnabled()){
150 150
             $cache = new StemplerCache($viewConfig->getCacheDirectory());
151 151
         }
152 152
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -95,7 +95,8 @@  discard block
 block discarded – undo
95 95
 
96 96
         $views->addEngine(StemplerEngine::class);
97 97
 
98
-        if ($container->has(LocaleProcessor::class)) {
98
+        if ($container->has(LocaleProcessor::class))
99
+        {
99 100
             $this->addProcessor(LocaleProcessor::class);
100 101
         }
101 102
     }
@@ -146,7 +147,8 @@  discard block
 block discarded – undo
146 147
         ViewsConfig $viewConfig
147 148
     ): StemplerEngine {
148 149
         $cache = null;
149
-        if ($viewConfig->isCacheEnabled()) {
150
+        if ($viewConfig->isCacheEnabled())
151
+        {
150 152
             $cache = new StemplerCache($viewConfig->getCacheDirectory());
151 153
         }
152 154
 
Please login to merge, or discard this patch.
src/StemplerBridge/tests/config/views.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@
 block discarded – undo
3 3
 return [
4 4
     'cache'        => [
5 5
         'enabled'   => false,
6
-        'directory' => __DIR__ . '/../cache'
6
+        'directory' => __DIR__.'/../cache'
7 7
     ],
8 8
     'namespaces'   => [
9
-        'default'    => [__DIR__ . '/../fixtures/default'],
10
-        'other'      => [__DIR__ . '/../fixtures/other'],
11
-        'extensions' => [__DIR__ . '/../fixtures/other/extensions'],
9
+        'default'    => [__DIR__.'/../fixtures/default'],
10
+        'other'      => [__DIR__.'/../fixtures/other'],
11
+        'extensions' => [__DIR__.'/../fixtures/other/extensions'],
12 12
     ],
13 13
     'dependencies' => [],
14 14
     'engines'      => []
Please login to merge, or discard this patch.
src/StemplerBridge/tests/ConfigTest.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
     public function testBootloaderDirective(): void
85 85
     {
86
-        $this->container->bind('testBinding', function () {
86
+        $this->container->bind('testBinding', function (){
87 87
             return 'test result';
88 88
         });
89 89
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
     public function testBootloaderProcessors(): void
103 103
     {
104
-        $this->container->bind('testBinding', function () {
104
+        $this->container->bind('testBinding', function (){
105 105
             return 'test result';
106 106
         });
107 107
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
     public function testBootloaderVisitors(): void
121 121
     {
122
-        $this->container->bind('testBinding', function () {
122
+        $this->container->bind('testBinding', function (){
123 123
             return 'test result';
124 124
         });
125 125
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
     public function testBootloaderVisitors0(): void
139 139
     {
140
-        $this->container->bind('testBinding', function () {
140
+        $this->container->bind('testBinding', function (){
141 141
             return 'test result';
142 142
         });
143 143
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
     public function testBootloaderVisitors2(): void
157 157
     {
158
-        $this->container->bind('testBinding', function () {
158
+        $this->container->bind('testBinding', function (){
159 159
             return 'test result';
160 160
         });
161 161
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
     public function testBootloaderVisitors3(): void
175 175
     {
176
-        $this->container->bind('testBinding', function () {
176
+        $this->container->bind('testBinding', function (){
177 177
             return 'test result';
178 178
         });
179 179
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,7 +83,8 @@  discard block
 block discarded – undo
83 83
 
84 84
     public function testBootloaderDirective(): void
85 85
     {
86
-        $this->container->bind('testBinding', function () {
86
+        $this->container->bind('testBinding', function ()
87
+        {
87 88
             return 'test result';
88 89
         });
89 90
 
@@ -101,7 +102,8 @@  discard block
 block discarded – undo
101 102
 
102 103
     public function testBootloaderProcessors(): void
103 104
     {
104
-        $this->container->bind('testBinding', function () {
105
+        $this->container->bind('testBinding', function ()
106
+        {
105 107
             return 'test result';
106 108
         });
107 109
 
@@ -119,7 +121,8 @@  discard block
 block discarded – undo
119 121
 
120 122
     public function testBootloaderVisitors(): void
121 123
     {
122
-        $this->container->bind('testBinding', function () {
124
+        $this->container->bind('testBinding', function ()
125
+        {
123 126
             return 'test result';
124 127
         });
125 128
 
@@ -137,7 +140,8 @@  discard block
 block discarded – undo
137 140
 
138 141
     public function testBootloaderVisitors0(): void
139 142
     {
140
-        $this->container->bind('testBinding', function () {
143
+        $this->container->bind('testBinding', function ()
144
+        {
141 145
             return 'test result';
142 146
         });
143 147
 
@@ -155,7 +159,8 @@  discard block
 block discarded – undo
155 159
 
156 160
     public function testBootloaderVisitors2(): void
157 161
     {
158
-        $this->container->bind('testBinding', function () {
162
+        $this->container->bind('testBinding', function ()
163
+        {
159 164
             return 'test result';
160 165
         });
161 166
 
@@ -173,7 +178,8 @@  discard block
 block discarded – undo
173 178
 
174 179
     public function testBootloaderVisitors3(): void
175 180
     {
176
-        $this->container->bind('testBinding', function () {
181
+        $this->container->bind('testBinding', function ()
182
+        {
177 183
             return 'test result';
178 184
         });
179 185
 
Please login to merge, or discard this patch.