Completed
Push — master ( 6366df...fbe022 )
by Kirill
23s queued 19s
created
src/Prototype/src/Command/AbstractCommand.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         $results = [$this->readProperties($class)];
59 59
 
60 60
         $parent = $class->getParentClass();
61
-        while ($parent instanceof \ReflectionClass && isset($all[$parent->getName()])) {
61
+        while ($parent instanceof \ReflectionClass && isset($all[$parent->getName()])){
62 62
             $results[] = $this->readProperties($parent);
63 63
             $parent = $parent->getParentClass();
64 64
         }
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
     {
92 92
         $result = [];
93 93
 
94
-        foreach ($properties as $target) {
95
-            if ($target instanceof \Throwable) {
94
+        foreach ($properties as $target){
95
+            if ($target instanceof \Throwable){
96 96
                 $result[] = sprintf(
97 97
                     '<fg=red>%s [f: %s, l: %s]</fg=red>',
98 98
                     $target->getMessage(),
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
                 continue;
103 103
             }
104 104
 
105
-            if ($target === null) {
105
+            if ($target === null){
106 106
                 $result[] = '<fg=yellow>undefined</fg=yellow>';
107 107
                 continue;
108 108
             }
@@ -115,16 +115,16 @@  discard block
 block discarded – undo
115 115
 
116 116
     private function readProperties(\ReflectionClass $class): array
117 117
     {
118
-        if (isset($this->cache[$class->getFileName()])) {
118
+        if (isset($this->cache[$class->getFileName()])){
119 119
             $proto = $this->cache[$class->getFileName()];
120
-        } else {
120
+        }else{
121 121
             $proto = $this->getExtractor()->getPrototypeProperties(file_get_contents($class->getFilename()));
122 122
             $this->cache[$class->getFileName()] = $proto;
123 123
         }
124 124
 
125 125
         $result = [];
126
-        foreach ($proto as $name) {
127
-            if (!isset($result[$name])) {
126
+        foreach ($proto as $name){
127
+            if (!isset($result[$name])){
128 128
                 $result[$name] = $this->registry->resolveProperty($name);
129 129
             }
130 130
         }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
     private function reverse(array $results): ?\Generator
136 136
     {
137
-        foreach (array_reverse($results) as $result) {
137
+        foreach (array_reverse($results) as $result){
138 138
             yield from $result;
139 139
         }
140 140
     }
Please login to merge, or discard this patch.
Braces   +19 added lines, -9 removed lines patch added patch discarded remove patch
@@ -58,7 +58,8 @@  discard block
 block discarded – undo
58 58
         $results = [$this->readProperties($class)];
59 59
 
60 60
         $parent = $class->getParentClass();
61
-        while ($parent instanceof \ReflectionClass && isset($all[$parent->getName()])) {
61
+        while ($parent instanceof \ReflectionClass && isset($all[$parent->getName()]))
62
+        {
62 63
             $results[] = $this->readProperties($parent);
63 64
             $parent = $parent->getParentClass();
64 65
         }
@@ -91,8 +92,10 @@  discard block
 block discarded – undo
91 92
     {
92 93
         $result = [];
93 94
 
94
-        foreach ($properties as $target) {
95
-            if ($target instanceof \Throwable) {
95
+        foreach ($properties as $target)
96
+        {
97
+            if ($target instanceof \Throwable)
98
+            {
96 99
                 $result[] = sprintf(
97 100
                     '<fg=red>%s [f: %s, l: %s]</fg=red>',
98 101
                     $target->getMessage(),
@@ -102,7 +105,8 @@  discard block
 block discarded – undo
102 105
                 continue;
103 106
             }
104 107
 
105
-            if ($target === null) {
108
+            if ($target === null)
109
+            {
106 110
                 $result[] = '<fg=yellow>undefined</fg=yellow>';
107 111
                 continue;
108 112
             }
@@ -115,16 +119,21 @@  discard block
 block discarded – undo
115 119
 
116 120
     private function readProperties(\ReflectionClass $class): array
117 121
     {
118
-        if (isset($this->cache[$class->getFileName()])) {
122
+        if (isset($this->cache[$class->getFileName()]))
123
+        {
119 124
             $proto = $this->cache[$class->getFileName()];
120
-        } else {
125
+        }
126
+        else
127
+        {
121 128
             $proto = $this->getExtractor()->getPrototypeProperties(file_get_contents($class->getFilename()));
122 129
             $this->cache[$class->getFileName()] = $proto;
123 130
         }
124 131
 
125 132
         $result = [];
126
-        foreach ($proto as $name) {
127
-            if (!isset($result[$name])) {
133
+        foreach ($proto as $name)
134
+        {
135
+            if (!isset($result[$name]))
136
+            {
128 137
                 $result[$name] = $this->registry->resolveProperty($name);
129 138
             }
130 139
         }
@@ -134,7 +143,8 @@  discard block
 block discarded – undo
134 143
 
135 144
     private function reverse(array $results): ?\Generator
136 145
     {
137
-        foreach (array_reverse($results) as $result) {
146
+        foreach (array_reverse($results) as $result)
147
+        {
138 148
             yield from $result;
139 149
         }
140 150
     }
Please login to merge, or discard this patch.
src/SendIt/tests/JobTest.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
             ['emails' => ['[email protected]']]
76 76
         );
77 77
 
78
-        try {
78
+        try{
79 79
             $this->getHandler()->handle(
80 80
                 MailQueue::JOB_NAME,
81 81
                 'id',
82 82
                 json_encode(MessageSerializer::pack($this->getMail()))
83 83
             );
84
-        } catch (TransportException $e) {
84
+        }catch (TransportException $e){
85 85
         }
86 86
 
87 87
         $this->logger->mockery_verify();
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     private function expectRenderer(Email $email): void
99 99
     {
100 100
         $this->renderer->expects('render')->withArgs(
101
-            function (Message $message) {
101
+            function (Message $message){
102 102
                 $this->assertSame($message->getSubject(), 'test');
103 103
                 return true;
104 104
             }
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -75,13 +75,16 @@  discard block
 block discarded – undo
75 75
             ['emails' => ['[email protected]']]
76 76
         );
77 77
 
78
-        try {
78
+        try
79
+        {
79 80
             $this->getHandler()->handle(
80 81
                 MailQueue::JOB_NAME,
81 82
                 'id',
82 83
                 json_encode(MessageSerializer::pack($this->getMail()))
83 84
             );
84
-        } catch (TransportException $e) {
85
+        }
86
+        catch (TransportException $e)
87
+        {
85 88
         }
86 89
 
87 90
         $this->logger->mockery_verify();
@@ -98,7 +101,8 @@  discard block
 block discarded – undo
98 101
     private function expectRenderer(Email $email): void
99 102
     {
100 103
         $this->renderer->expects('render')->withArgs(
101
-            function (Message $message) {
104
+            function (Message $message)
105
+            {
102 106
                 $this->assertSame($message->getSubject(), 'test');
103 107
                 return true;
104 108
             }
Please login to merge, or discard this patch.
src/Prototype/src/Command/InjectCommand.php 2 patches
Braces   +25 added lines, -12 removed lines patch added patch discarded remove patch
@@ -55,7 +55,8 @@  discard block
 block discarded – undo
55 55
     public function perform(): void
56 56
     {
57 57
         $prototyped = $this->locator->getTargetClasses();
58
-        if ($prototyped === []) {
58
+        if ($prototyped === [])
59
+        {
59 60
             $this->writeln('<comment>No prototyped classes found.</comment>');
60 61
 
61 62
             return;
@@ -63,18 +64,23 @@  discard block
 block discarded – undo
63 64
 
64 65
         $targets = [];
65 66
 
66
-        foreach ($prototyped as $class) {
67
+        foreach ($prototyped as $class)
68
+        {
67 69
             $proto = $this->getPrototypeProperties($class, $prototyped);
68
-            if (empty($proto)) {
70
+            if (empty($proto))
71
+            {
69 72
                 $modified = $this->modify($class, $proto);
70
-                if ($modified !== null) {
73
+                if ($modified !== null)
74
+                {
71 75
                     $targets[] = $modified;
72 76
                 }
73 77
                 continue;
74 78
             }
75 79
 
76
-            foreach ($proto as $target) {
77
-                if ($target instanceof \Throwable) {
80
+            foreach ($proto as $target)
81
+            {
82
+                if ($target instanceof \Throwable)
83
+                {
78 84
                     $targets[] = [
79 85
                         $class->getName(),
80 86
                         $target->getMessage(),
@@ -83,7 +89,8 @@  discard block
 block discarded – undo
83 89
                     continue 2;
84 90
                 }
85 91
 
86
-                if ($target === null) {
92
+                if ($target === null)
93
+                {
87 94
                     continue 2;
88 95
                 }
89 96
             }
@@ -91,14 +98,17 @@  discard block
 block discarded – undo
91 98
             $targets[] = [$class->getName(), $this->mergeNames($proto), $this->mergeTargets($proto)];
92 99
 
93 100
             $modified = $this->modify($class, $proto);
94
-            if ($modified !== null) {
101
+            if ($modified !== null)
102
+            {
95 103
                 $targets[] = $modified;
96 104
             }
97 105
         }
98 106
 
99
-        if (!empty($targets)) {
107
+        if (!empty($targets))
108
+        {
100 109
             $grid = $this->table(['Class:', 'Property:', 'Target:']);
101
-            foreach ($targets as $target) {
110
+            foreach ($targets as $target)
111
+            {
102 112
                 $grid->addRow($target);
103 113
             }
104 114
 
@@ -109,7 +119,8 @@  discard block
 block discarded – undo
109 119
     private function modify(\ReflectionClass $class, array $proto): ?array
110 120
     {
111 121
         $classDefinition = $this->extractor->extract($class->getFilename(), $proto);
112
-        try {
122
+        try
123
+        {
113 124
             $modified = $this->injector->injectDependencies(
114 125
                 file_get_contents($class->getFileName()),
115 126
                 $classDefinition,
@@ -120,7 +131,9 @@  discard block
 block discarded – undo
120 131
 
121 132
             file_put_contents($class->getFileName(), $modified);
122 133
             return null;
123
-        } catch (\Throwable $e) {
134
+        }
135
+        catch (\Throwable $e)
136
+        {
124 137
             return [$class->getName(), $e->getMessage(), "{$e->getFile()}:L{$e->getLine()}"];
125 138
         }
126 139
     }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     public function perform(): void
52 52
     {
53 53
         $prototyped = $this->locator->getTargetClasses();
54
-        if ($prototyped === []) {
54
+        if ($prototyped === []){
55 55
             $this->writeln('<comment>No prototyped classes found.</comment>');
56 56
 
57 57
             return;
@@ -59,18 +59,18 @@  discard block
 block discarded – undo
59 59
 
60 60
         $targets = [];
61 61
 
62
-        foreach ($prototyped as $class) {
62
+        foreach ($prototyped as $class){
63 63
             $proto = $this->getPrototypeProperties($class, $prototyped);
64
-            if (empty($proto)) {
64
+            if (empty($proto)){
65 65
                 $modified = $this->modify($class, $proto);
66
-                if ($modified !== null) {
66
+                if ($modified !== null){
67 67
                     $targets[] = $modified;
68 68
                 }
69 69
                 continue;
70 70
             }
71 71
 
72
-            foreach ($proto as $target) {
73
-                if ($target instanceof \Throwable) {
72
+            foreach ($proto as $target){
73
+                if ($target instanceof \Throwable){
74 74
                     $targets[] = [
75 75
                         $class->getName(),
76 76
                         $target->getMessage(),
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                     continue 2;
80 80
                 }
81 81
 
82
-                if ($target === null) {
82
+                if ($target === null){
83 83
                     continue 2;
84 84
                 }
85 85
             }
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
             $targets[] = [$class->getName(), $this->mergeNames($proto), $this->mergeTargets($proto)];
88 88
 
89 89
             $modified = $this->modify($class, $proto);
90
-            if ($modified !== null) {
90
+            if ($modified !== null){
91 91
                 $targets[] = $modified;
92 92
             }
93 93
         }
94 94
 
95
-        if (!empty($targets)) {
95
+        if (!empty($targets)){
96 96
             $grid = $this->table(['Class:', 'Property:', 'Target:']);
97
-            foreach ($targets as $target) {
97
+            foreach ($targets as $target){
98 98
                 $grid->addRow($target);
99 99
             }
100 100
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     private function modify(\ReflectionClass $class, array $proto): ?array
106 106
     {
107 107
         $classDefinition = $this->extractor->extract($class->getFilename(), $proto);
108
-        try {
108
+        try{
109 109
             $modified = $this->injector->injectDependencies(
110 110
                 file_get_contents($class->getFileName()),
111 111
                 $classDefinition,
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
             file_put_contents($class->getFileName(), $modified);
118 118
             return null;
119
-        } catch (\Throwable $e) {
119
+        }catch (\Throwable $e){
120 120
             return [$class->getName(), $e->getMessage(), "{$e->getFile()}:L{$e->getLine()}"];
121 121
         }
122 122
     }
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/UpdateConstructor.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function leaveNode(Node $node)
44 44
     {
45
-        if (!$node instanceof Node\Stmt\Class_) {
45
+        if (!$node instanceof Node\Stmt\Class_){
46 46
             return null;
47 47
         }
48 48
 
49 49
         $constructor = $this->getConstructorAttribute($node);
50 50
         $this->addDependencies($constructor);
51
-        if (!$this->definition->hasConstructor && $this->definition->constructorParams) {
51
+        if (!$this->definition->hasConstructor && $this->definition->constructorParams){
52 52
             $this->addParentConstructorCall($constructor);
53 53
         }
54 54
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      */
67 67
     private function addDependencies(Node\Stmt\ClassMethod $constructor): void
68 68
     {
69
-        foreach ($this->definition->dependencies as $dependency) {
69
+        foreach ($this->definition->dependencies as $dependency){
70 70
             array_unshift($constructor->params, $this->buildConstructorParam($dependency));
71 71
             array_unshift(
72 72
                 $constructor->stmts,
@@ -92,34 +92,34 @@  discard block
 block discarded – undo
92 92
     private function addParentConstructorCall(Node\Stmt\ClassMethod $constructor): void
93 93
     {
94 94
         $parentConstructorDependencies = [];
95
-        foreach ($this->definition->constructorParams as $param) {
95
+        foreach ($this->definition->constructorParams as $param){
96 96
             $parentConstructorDependencies[] = new Node\Arg(new Node\Expr\Variable($param->name));
97 97
 
98 98
             $cp = new Param($param->name);
99
-            if (!empty($param->type)) {
99
+            if (!empty($param->type)){
100 100
                 $type = $this->getParamType($param);
101
-                if ($param->nullable) {
101
+                if ($param->nullable){
102 102
                     $type = "?$type";
103 103
                 }
104 104
 
105 105
                 $cp->setType(new Node\Name($type));
106 106
             }
107 107
 
108
-            if ($param->byRef) {
108
+            if ($param->byRef){
109 109
                 $cp->makeByRef();
110 110
             }
111 111
 
112
-            if ($param->isVariadic) {
112
+            if ($param->isVariadic){
113 113
                 $cp->makeVariadic();
114 114
             }
115 115
 
116
-            if ($param->hasDefault) {
116
+            if ($param->hasDefault){
117 117
                 $cp->setDefault($param->default);
118 118
             }
119 119
             $constructor->params[] = $cp->getNode();
120 120
         }
121 121
 
122
-        if ($parentConstructorDependencies) {
122
+        if ($parentConstructorDependencies){
123 123
             array_unshift(
124 124
                 $constructor->stmts,
125 125
                 new Node\Stmt\Expression(
@@ -154,18 +154,18 @@  discard block
 block discarded – undo
154 154
 
155 155
         $params = [];
156 156
 
157
-        foreach ($this->definition->dependencies as $dependency) {
157
+        foreach ($this->definition->dependencies as $dependency){
158 158
             $params[] = new Annotation\Line(
159 159
                 sprintf('%s $%s', $this->getPropertyType($dependency), $dependency->var),
160 160
                 'param'
161 161
             );
162 162
         }
163 163
 
164
-        if (!$this->definition->hasConstructor) {
165
-            foreach ($this->definition->constructorParams as $param) {
166
-                if (!empty($param->type)) {
164
+        if (!$this->definition->hasConstructor){
165
+            foreach ($this->definition->constructorParams as $param){
166
+                if (!empty($param->type)){
167 167
                     $type = $this->getParamType($param);
168
-                    if ($param->nullable) {
168
+                    if ($param->nullable){
169 169
                         $type = "$type|null";
170 170
                     }
171 171
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
                         sprintf($param->isVariadic ? '%s ...$%s' : '%s $%s', $type, $param->name),
174 174
                         'param'
175 175
                     );
176
-                } else {
176
+                }else{
177 177
                     $params[] = new Annotation\Line(
178 178
                         sprintf('$%s', $param->name),
179 179
                         'param'
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
 
185 185
         $placementID = 0;
186 186
         $previous = null;
187
-        foreach ($an->lines as $index => $line) {
187
+        foreach ($an->lines as $index => $line){
188 188
             // always next node
189 189
             $placementID = $index + 1;
190 190
 
191 191
             // inject before this parameters
192
-            if ($line->is(['throws', 'return'])) {
192
+            if ($line->is(['throws', 'return'])){
193 193
                 // insert before given node
194 194
                 $placementID--;
195 195
                 break;
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
             $previous = $line;
199 199
         }
200 200
 
201
-        if ($previous !== null && !$previous->isEmpty()) {
201
+        if ($previous !== null && !$previous->isEmpty()){
202 202
             $placementID++;
203 203
         }
204 204
 
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
      */
214 214
     private function getPropertyType(Dependency $dependency): string
215 215
     {
216
-        foreach ($this->definition->getStmts() as $stmt) {
217
-            if ($stmt->name === $dependency->type->fullName) {
218
-                if ($stmt->alias) {
216
+        foreach ($this->definition->getStmts() as $stmt){
217
+            if ($stmt->name === $dependency->type->fullName){
218
+                if ($stmt->alias){
219 219
                     return $stmt->alias;
220 220
                 }
221 221
             }
@@ -230,15 +230,15 @@  discard block
 block discarded – undo
230 230
      */
231 231
     private function getParamType(ClassNode\ConstructorParam $param): string
232 232
     {
233
-        foreach ($this->definition->getStmts() as $stmt) {
234
-            if ($stmt->name === $param->type->fullName) {
235
-                if ($stmt->alias) {
233
+        foreach ($this->definition->getStmts() as $stmt){
234
+            if ($stmt->name === $param->type->fullName){
235
+                if ($stmt->alias){
236 236
                     return $stmt->alias;
237 237
                 }
238 238
             }
239 239
         }
240 240
 
241
-        if ($param->type->alias) {
241
+        if ($param->type->alias){
242 242
             return $param->type->alias;
243 243
         }
244 244
 
Please login to merge, or discard this patch.
Braces   +53 added lines, -26 removed lines patch added patch discarded remove patch
@@ -42,13 +42,15 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function leaveNode(Node $node)
44 44
     {
45
-        if (!$node instanceof Node\Stmt\Class_) {
45
+        if (!$node instanceof Node\Stmt\Class_)
46
+        {
46 47
             return null;
47 48
         }
48 49
 
49 50
         $constructor = $this->getConstructorAttribute($node);
50 51
         $this->addDependencies($constructor);
51
-        if (!$this->definition->hasConstructor && $this->definition->constructorParams) {
52
+        if (!$this->definition->hasConstructor && $this->definition->constructorParams)
53
+        {
52 54
             $this->addParentConstructorCall($constructor);
53 55
         }
54 56
 
@@ -66,7 +68,8 @@  discard block
 block discarded – undo
66 68
      */
67 69
     private function addDependencies(Node\Stmt\ClassMethod $constructor): void
68 70
     {
69
-        foreach ($this->definition->dependencies as $dependency) {
71
+        foreach ($this->definition->dependencies as $dependency)
72
+        {
70 73
             array_unshift($constructor->params, $this->buildConstructorParam($dependency));
71 74
             array_unshift(
72 75
                 $constructor->stmts,
@@ -92,34 +95,41 @@  discard block
 block discarded – undo
92 95
     private function addParentConstructorCall(Node\Stmt\ClassMethod $constructor): void
93 96
     {
94 97
         $parentConstructorDependencies = [];
95
-        foreach ($this->definition->constructorParams as $param) {
98
+        foreach ($this->definition->constructorParams as $param)
99
+        {
96 100
             $parentConstructorDependencies[] = new Node\Arg(new Node\Expr\Variable($param->name));
97 101
 
98 102
             $cp = new Param($param->name);
99
-            if (!empty($param->type)) {
103
+            if (!empty($param->type))
104
+            {
100 105
                 $type = $this->getParamType($param);
101
-                if ($param->nullable) {
106
+                if ($param->nullable)
107
+                {
102 108
                     $type = "?$type";
103 109
                 }
104 110
 
105 111
                 $cp->setType(new Node\Name($type));
106 112
             }
107 113
 
108
-            if ($param->byRef) {
114
+            if ($param->byRef)
115
+            {
109 116
                 $cp->makeByRef();
110 117
             }
111 118
 
112
-            if ($param->isVariadic) {
119
+            if ($param->isVariadic)
120
+            {
113 121
                 $cp->makeVariadic();
114 122
             }
115 123
 
116
-            if ($param->hasDefault) {
124
+            if ($param->hasDefault)
125
+            {
117 126
                 $cp->setDefault($param->default);
118 127
             }
119 128
             $constructor->params[] = $cp->getNode();
120 129
         }
121 130
 
122
-        if ($parentConstructorDependencies) {
131
+        if ($parentConstructorDependencies)
132
+        {
123 133
             array_unshift(
124 134
                 $constructor->stmts,
125 135
                 new Node\Stmt\Expression(
@@ -154,18 +164,23 @@  discard block
 block discarded – undo
154 164
 
155 165
         $params = [];
156 166
 
157
-        foreach ($this->definition->dependencies as $dependency) {
167
+        foreach ($this->definition->dependencies as $dependency)
168
+        {
158 169
             $params[] = new Annotation\Line(
159 170
                 sprintf('%s $%s', $this->getPropertyType($dependency), $dependency->var),
160 171
                 'param'
161 172
             );
162 173
         }
163 174
 
164
-        if (!$this->definition->hasConstructor) {
165
-            foreach ($this->definition->constructorParams as $param) {
166
-                if (!empty($param->type)) {
175
+        if (!$this->definition->hasConstructor)
176
+        {
177
+            foreach ($this->definition->constructorParams as $param)
178
+            {
179
+                if (!empty($param->type))
180
+                {
167 181
                     $type = $this->getParamType($param);
168
-                    if ($param->nullable) {
182
+                    if ($param->nullable)
183
+                    {
169 184
                         $type = "$type|null";
170 185
                     }
171 186
 
@@ -173,7 +188,9 @@  discard block
 block discarded – undo
173 188
                         sprintf($param->isVariadic ? '%s ...$%s' : '%s $%s', $type, $param->name),
174 189
                         'param'
175 190
                     );
176
-                } else {
191
+                }
192
+                else
193
+                {
177 194
                     $params[] = new Annotation\Line(
178 195
                         sprintf('$%s', $param->name),
179 196
                         'param'
@@ -184,12 +201,14 @@  discard block
 block discarded – undo
184 201
 
185 202
         $placementID = 0;
186 203
         $previous = null;
187
-        foreach ($an->lines as $index => $line) {
204
+        foreach ($an->lines as $index => $line)
205
+        {
188 206
             // always next node
189 207
             $placementID = $index + 1;
190 208
 
191 209
             // inject before this parameters
192
-            if ($line->is(['throws', 'return'])) {
210
+            if ($line->is(['throws', 'return']))
211
+            {
193 212
                 // insert before given node
194 213
                 $placementID--;
195 214
                 break;
@@ -198,7 +217,8 @@  discard block
 block discarded – undo
198 217
             $previous = $line;
199 218
         }
200 219
 
201
-        if ($previous !== null && !$previous->isEmpty()) {
220
+        if ($previous !== null && !$previous->isEmpty())
221
+        {
202 222
             $placementID++;
203 223
         }
204 224
 
@@ -213,9 +233,12 @@  discard block
 block discarded – undo
213 233
      */
214 234
     private function getPropertyType(Dependency $dependency): string
215 235
     {
216
-        foreach ($this->definition->getStmts() as $stmt) {
217
-            if ($stmt->name === $dependency->type->fullName) {
218
-                if ($stmt->alias) {
236
+        foreach ($this->definition->getStmts() as $stmt)
237
+        {
238
+            if ($stmt->name === $dependency->type->fullName)
239
+            {
240
+                if ($stmt->alias)
241
+                {
219 242
                     return $stmt->alias;
220 243
                 }
221 244
             }
@@ -230,15 +253,19 @@  discard block
 block discarded – undo
230 253
      */
231 254
     private function getParamType(ClassNode\ConstructorParam $param): string
232 255
     {
233
-        foreach ($this->definition->getStmts() as $stmt) {
234
-            if ($stmt->name === $param->type->fullName) {
235
-                if ($stmt->alias) {
256
+        foreach ($this->definition->getStmts() as $stmt)
257
+        {
258
+            if ($stmt->name === $param->type->fullName)
259
+            {
260
+                if ($stmt->alias)
261
+                {
236 262
                     return $stmt->alias;
237 263
                 }
238 264
             }
239 265
         }
240 266
 
241
-        if ($param->type->alias) {
267
+        if ($param->type->alias)
268
+        {
242 269
             return $param->type->alias;
243 270
         }
244 271
 
Please login to merge, or discard this patch.
src/DataGrid/src/GridFactory.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         ['view' => $view, 'source' => $source] = $this->applySorters($view, $source, $schema);
109 109
         ['view' => $view, 'source' => $source] = $this->applyPaginator($view, $source, $schema);
110 110
 
111
-        if (!is_iterable($source)) {
111
+        if (!is_iterable($source)){
112 112
             throw new GridViewException('GridView expects the source to be iterable after all.');
113 113
         }
114 114
 
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
     protected function getFilters($source, GridSchema $schema): array
127 127
     {
128 128
         $filters = [];
129
-        foreach ($this->getOptionArray(static::KEY_FILTER) ?? [] as $name => $value) {
130
-            if ($schema->hasFilter($name)) {
129
+        foreach ($this->getOptionArray(static::KEY_FILTER) ?? [] as $name => $value){
130
+            if ($schema->hasFilter($name)){
131 131
                 $filter = $schema->getFilter($name)->withValue($value);
132 132
 
133
-                if ($filter !== null) {
133
+                if ($filter !== null){
134 134
                     $source = $this->compiler->compile($source, $filter);
135 135
                     $filters[$name] = $filter->getValue();
136 136
                 }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
     protected function applyCounter(GridInterface $view, $source, GridSchema $schema): array
144 144
     {
145
-        if (is_countable($source) && $this->getOption(static::KEY_FETCH_COUNT)) {
145
+        if (is_countable($source) && $this->getOption(static::KEY_FETCH_COUNT)){
146 146
             $view = $view->withOption(GridInterface::COUNT, ($this->count)($source));
147 147
         }
148 148
 
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
     protected function getSorters($source, GridSchema $schema): array
161 161
     {
162 162
         $sorters = [];
163
-        foreach ($this->getOptionArray(static::KEY_SORT) ?? [] as $name => $value) {
164
-            if ($schema->hasSorter($name)) {
163
+        foreach ($this->getOptionArray(static::KEY_SORT) ?? [] as $name => $value){
164
+            if ($schema->hasSorter($name)){
165 165
                 $sorter = $schema->getSorter($name)->withDirection($value);
166 166
 
167
-                if ($sorter !== null) {
167
+                if ($sorter !== null){
168 168
                     $source = $this->compiler->compile($source, $sorter);
169 169
                     $sorters[$name] = $sorter->getValue();
170 170
                 }
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
     protected function applyPaginator(GridInterface $view, $source, GridSchema $schema): array
178 178
     {
179
-        if ($schema->getPaginator() !== null) {
179
+        if ($schema->getPaginator() !== null){
180 180
             ['source' => $source, 'paginator' => $paginator] = $this->getPaginator($source, $schema);
181 181
             $view = $view->withOption(GridInterface::PAGINATOR, $paginator);
182 182
         }
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
     protected function getPaginator($source, GridSchema $schema): array
188 188
     {
189 189
         $paginator = $schema->getPaginator();
190
-        if (!$paginator instanceof FilterInterface) {
190
+        if (!$paginator instanceof FilterInterface){
191 191
             throw new CompilerException('Paginator can not be null');
192 192
         }
193 193
 
194 194
         $withValue = $paginator->withValue($this->getOption(static::KEY_PAGINATE));
195
-        if ($withValue === null) {
195
+        if ($withValue === null){
196 196
             throw new CompilerException('Paginator can not be null');
197 197
         }
198 198
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     protected function getOptionArray(string $option): array
212 212
     {
213 213
         $result = $this->getOption($option);
214
-        if (!is_array($result)) {
214
+        if (!is_array($result)){
215 215
             return [];
216 216
         }
217 217
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
      */
227 227
     protected function getOption(string $option)
228 228
     {
229
-        if ($this->input->hasValue($option)) {
229
+        if ($this->input->hasValue($option)){
230 230
             return $this->input->getValue($option);
231 231
         }
232 232
 
Please login to merge, or discard this patch.
Braces   +26 added lines, -13 removed lines patch added patch discarded remove patch
@@ -108,7 +108,8 @@  discard block
 block discarded – undo
108 108
         ['view' => $view, 'source' => $source] = $this->applySorters($view, $source, $schema);
109 109
         ['view' => $view, 'source' => $source] = $this->applyPaginator($view, $source, $schema);
110 110
 
111
-        if (!is_iterable($source)) {
111
+        if (!is_iterable($source))
112
+        {
112 113
             throw new GridViewException('GridView expects the source to be iterable after all.');
113 114
         }
114 115
 
@@ -126,11 +127,14 @@  discard block
 block discarded – undo
126 127
     protected function getFilters($source, GridSchema $schema): array
127 128
     {
128 129
         $filters = [];
129
-        foreach ($this->getOptionArray(static::KEY_FILTER) ?? [] as $name => $value) {
130
-            if ($schema->hasFilter($name)) {
130
+        foreach ($this->getOptionArray(static::KEY_FILTER) ?? [] as $name => $value)
131
+        {
132
+            if ($schema->hasFilter($name))
133
+            {
131 134
                 $filter = $schema->getFilter($name)->withValue($value);
132 135
 
133
-                if ($filter !== null) {
136
+                if ($filter !== null)
137
+                {
134 138
                     $source = $this->compiler->compile($source, $filter);
135 139
                     $filters[$name] = $filter->getValue();
136 140
                 }
@@ -142,7 +146,8 @@  discard block
 block discarded – undo
142 146
 
143 147
     protected function applyCounter(GridInterface $view, $source, GridSchema $schema): array
144 148
     {
145
-        if (is_countable($source) && $this->getOption(static::KEY_FETCH_COUNT)) {
149
+        if (is_countable($source) && $this->getOption(static::KEY_FETCH_COUNT))
150
+        {
146 151
             $view = $view->withOption(GridInterface::COUNT, ($this->count)($source));
147 152
         }
148 153
 
@@ -160,11 +165,14 @@  discard block
 block discarded – undo
160 165
     protected function getSorters($source, GridSchema $schema): array
161 166
     {
162 167
         $sorters = [];
163
-        foreach ($this->getOptionArray(static::KEY_SORT) ?? [] as $name => $value) {
164
-            if ($schema->hasSorter($name)) {
168
+        foreach ($this->getOptionArray(static::KEY_SORT) ?? [] as $name => $value)
169
+        {
170
+            if ($schema->hasSorter($name))
171
+            {
165 172
                 $sorter = $schema->getSorter($name)->withDirection($value);
166 173
 
167
-                if ($sorter !== null) {
174
+                if ($sorter !== null)
175
+                {
168 176
                     $source = $this->compiler->compile($source, $sorter);
169 177
                     $sorters[$name] = $sorter->getValue();
170 178
                 }
@@ -176,7 +184,8 @@  discard block
 block discarded – undo
176 184
 
177 185
     protected function applyPaginator(GridInterface $view, $source, GridSchema $schema): array
178 186
     {
179
-        if ($schema->getPaginator() !== null) {
187
+        if ($schema->getPaginator() !== null)
188
+        {
180 189
             ['source' => $source, 'paginator' => $paginator] = $this->getPaginator($source, $schema);
181 190
             $view = $view->withOption(GridInterface::PAGINATOR, $paginator);
182 191
         }
@@ -187,12 +196,14 @@  discard block
 block discarded – undo
187 196
     protected function getPaginator($source, GridSchema $schema): array
188 197
     {
189 198
         $paginator = $schema->getPaginator();
190
-        if (!$paginator instanceof FilterInterface) {
199
+        if (!$paginator instanceof FilterInterface)
200
+        {
191 201
             throw new CompilerException('Paginator can not be null');
192 202
         }
193 203
 
194 204
         $withValue = $paginator->withValue($this->getOption(static::KEY_PAGINATE));
195
-        if ($withValue === null) {
205
+        if ($withValue === null)
206
+        {
196 207
             throw new CompilerException('Paginator can not be null');
197 208
         }
198 209
 
@@ -211,7 +222,8 @@  discard block
 block discarded – undo
211 222
     protected function getOptionArray(string $option): array
212 223
     {
213 224
         $result = $this->getOption($option);
214
-        if (!is_array($result)) {
225
+        if (!is_array($result))
226
+        {
215 227
             return [];
216 228
         }
217 229
 
@@ -226,7 +238,8 @@  discard block
 block discarded – undo
226 238
      */
227 239
     protected function getOption(string $option)
228 240
     {
229
-        if ($this->input->hasValue($option)) {
241
+        if ($this->input->hasValue($option))
242
+        {
230 243
             return $this->input->getValue($option);
231 244
         }
232 245
 
Please login to merge, or discard this patch.
src/DataGrid/src/Specification/Value/DatetimeFormatValue.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,19 +44,19 @@
 block discarded – undo
44 44
      */
45 45
     public function convert($value)
46 46
     {
47
-        try {
47
+        try{
48 48
             $datetime = DateTimeImmutable::createFromFormat($this->readFrom, (string)$value);
49
-            if (!$datetime instanceof DateTimeImmutable) {
49
+            if (!$datetime instanceof DateTimeImmutable){
50 50
                 return null;
51 51
             }
52 52
 
53
-            if ($this->convertInto !== null) {
53
+            if ($this->convertInto !== null){
54 54
                 $formatted = $datetime->format($this->convertInto);
55 55
                 return is_string($formatted) ? $formatted : null;
56 56
             }
57 57
 
58 58
             return $datetime;
59
-        } catch (Throwable $e) {
59
+        }catch (Throwable $e){
60 60
             return null;
61 61
         }
62 62
     }
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,19 +44,24 @@
 block discarded – undo
44 44
      */
45 45
     public function convert($value)
46 46
     {
47
-        try {
47
+        try
48
+        {
48 49
             $datetime = DateTimeImmutable::createFromFormat($this->readFrom, (string)$value);
49
-            if (!$datetime instanceof DateTimeImmutable) {
50
+            if (!$datetime instanceof DateTimeImmutable)
51
+            {
50 52
                 return null;
51 53
             }
52 54
 
53
-            if ($this->convertInto !== null) {
55
+            if ($this->convertInto !== null)
56
+            {
54 57
                 $formatted = $datetime->format($this->convertInto);
55 58
                 return is_string($formatted) ? $formatted : null;
56 59
             }
57 60
 
58 61
             return $datetime;
59
-        } catch (Throwable $e) {
62
+        }
63
+        catch (Throwable $e)
64
+        {
60 65
             return null;
61 66
         }
62 67
     }
Please login to merge, or discard this patch.
src/Validation/src/Checker/DatetimeChecker.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function format($value, string $format): bool
84 84
     {
85
-        if (!$this->isApplicableValue($value)) {
85
+        if (!$this->isApplicableValue($value)){
86 86
             return false;
87 87
         }
88 88
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      */
111 111
     public function timezone($value): bool
112 112
     {
113
-        if (!is_scalar($value)) {
113
+        if (!is_scalar($value)){
114 114
             return false;
115 115
         }
116 116
 
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
      */
151 151
     private function now(): ?\DateTimeInterface
152 152
     {
153
-        try {
153
+        try{
154 154
             return $this->date($this->now ?: 'now');
155
-        } catch (\Throwable $e) {
155
+        }catch (\Throwable $e){
156 156
             //here's the fail;
157 157
         }
158 158
 
@@ -165,25 +165,25 @@  discard block
 block discarded – undo
165 165
      */
166 166
     private function date($value): ?\DateTimeInterface
167 167
     {
168
-        if (is_callable($value)) {
168
+        if (is_callable($value)){
169 169
             $value = $value();
170 170
         }
171 171
 
172
-        if ($value instanceof \DateTimeInterface) {
172
+        if ($value instanceof \DateTimeInterface){
173 173
             return $value;
174 174
         }
175 175
 
176
-        if (!$this->isApplicableValue($value)) {
176
+        if (!$this->isApplicableValue($value)){
177 177
             return null;
178 178
         }
179 179
 
180
-        try {
181
-            if (!$value) {
180
+        try{
181
+            if (!$value){
182 182
                 $value = '0';
183 183
             }
184 184
 
185 185
             return new \DateTimeImmutable(is_numeric($value) ? sprintf('@%d', $value) : trim($value));
186
-        } catch (\Throwable $e) {
186
+        }catch (\Throwable $e){
187 187
             //here's the fail;
188 188
         }
189 189
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     private function fromField(string $field): ?\DateTimeInterface
207 207
     {
208 208
         $before = $this->getValidator()->getValue($field);
209
-        if ($before !== null) {
209
+        if ($before !== null){
210 210
             return $this->date($before);
211 211
         }
212 212
 
Please login to merge, or discard this patch.
Braces   +24 added lines, -11 removed lines patch added patch discarded remove patch
@@ -82,7 +82,8 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function format($value, string $format): bool
84 84
     {
85
-        if (!$this->isApplicableValue($value)) {
85
+        if (!$this->isApplicableValue($value))
86
+        {
86 87
             return false;
87 88
         }
88 89
 
@@ -110,7 +111,8 @@  discard block
 block discarded – undo
110 111
      */
111 112
     public function timezone($value): bool
112 113
     {
113
-        if (!is_scalar($value)) {
114
+        if (!is_scalar($value))
115
+        {
114 116
             return false;
115 117
         }
116 118
 
@@ -150,9 +152,12 @@  discard block
 block discarded – undo
150 152
      */
151 153
     private function now(): ?\DateTimeInterface
152 154
     {
153
-        try {
155
+        try
156
+        {
154 157
             return $this->date($this->now ?: 'now');
155
-        } catch (\Throwable $e) {
158
+        }
159
+        catch (\Throwable $e)
160
+        {
156 161
             //here's the fail;
157 162
         }
158 163
 
@@ -165,25 +170,32 @@  discard block
 block discarded – undo
165 170
      */
166 171
     private function date($value): ?\DateTimeInterface
167 172
     {
168
-        if (is_callable($value)) {
173
+        if (is_callable($value))
174
+        {
169 175
             $value = $value();
170 176
         }
171 177
 
172
-        if ($value instanceof \DateTimeInterface) {
178
+        if ($value instanceof \DateTimeInterface)
179
+        {
173 180
             return $value;
174 181
         }
175 182
 
176
-        if (!$this->isApplicableValue($value)) {
183
+        if (!$this->isApplicableValue($value))
184
+        {
177 185
             return null;
178 186
         }
179 187
 
180
-        try {
181
-            if (!$value) {
188
+        try
189
+        {
190
+            if (!$value)
191
+            {
182 192
                 $value = '0';
183 193
             }
184 194
 
185 195
             return new \DateTimeImmutable(is_numeric($value) ? sprintf('@%d', $value) : trim($value));
186
-        } catch (\Throwable $e) {
196
+        }
197
+        catch (\Throwable $e)
198
+        {
187 199
             //here's the fail;
188 200
         }
189 201
 
@@ -206,7 +218,8 @@  discard block
 block discarded – undo
206 218
     private function fromField(string $field): ?\DateTimeInterface
207 219
     {
208 220
         $before = $this->getValidator()->getValue($field);
209
-        if ($before !== null) {
221
+        if ($before !== null)
222
+        {
210 223
             return $this->date($before);
211 224
         }
212 225
 
Please login to merge, or discard this patch.
src/Validation/tests/Checkers/DatetimeTest.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             [true, $callableNow, $now, true, true]
45 45
         ];
46 46
 
47
-        $callableFutureTime = static function () {
47
+        $callableFutureTime = static function (){
48 48
             return time() + 1000;
49 49
         };
50 50
         yield from [
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             [false, $callableFutureTime, $now, true, true],
53 53
         ];
54 54
 
55
-        $callablePastTime = static function () {
55
+        $callablePastTime = static function (){
56 56
             return time() - 1000;
57 57
         };
58 58
         yield from [
@@ -231,24 +231,24 @@  discard block
 block discarded – undo
231 231
     public function validProvider(): array
232 232
     {
233 233
         return [
234
-            [true, time() - 1000,],
235
-            [true, time(),],
236
-            [true, date('u'),],
237
-            [true, time() + 1000,],
238
-            [true, '',],
239
-            [true, 'tomorrow +2hours',],
240
-            [true, 'yesterday -2hours',],
241
-            [true, 'now',],
242
-            [true, 'now + 1000 seconds',],
243
-            [true, 'now - 1000 seconds',],
244
-            [true, 0,],
245
-            [true, 1.1,],
246
-            [false, [],],
247
-            [false, false,],
248
-            [false, true,],
249
-            [false, null,],
250
-            [false, [],],
251
-            [false, new \stdClass(),],
234
+            [true, time() - 1000, ],
235
+            [true, time(), ],
236
+            [true, date('u'), ],
237
+            [true, time() + 1000, ],
238
+            [true, '', ],
239
+            [true, 'tomorrow +2hours', ],
240
+            [true, 'yesterday -2hours', ],
241
+            [true, 'now', ],
242
+            [true, 'now + 1000 seconds', ],
243
+            [true, 'now - 1000 seconds', ],
244
+            [true, 0, ],
245
+            [true, 1.1, ],
246
+            [false, [], ],
247
+            [false, false, ],
248
+            [false, true, ],
249
+            [false, null, ],
250
+            [false, [], ],
251
+            [false, new \stdClass(), ],
252 252
         ];
253 253
     }
254 254
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     {
257 257
         $checker = new DatetimeChecker();
258 258
 
259
-        foreach (\DateTimeZone::listIdentifiers() as $identifier) {
259
+        foreach (\DateTimeZone::listIdentifiers() as $identifier){
260 260
             $this->assertTrue($checker->timezone($identifier));
261 261
             $this->assertFalse($checker->timezone(str_rot13($identifier)));
262 262
         }
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 
398 398
     private function now(): \Closure
399 399
     {
400
-        return static function () {
400
+        return static function (){
401 401
             return \time();
402 402
         };
403 403
     }
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,7 +35,8 @@  discard block
 block discarded – undo
35 35
     public function nowProvider(): iterable
36 36
     {
37 37
         $now = new \DateTime();
38
-        $callableNow = static function () use ($now) {
38
+        $callableNow = static function () use ($now)
39
+        {
39 40
             return $now;
40 41
         };
41 42
 
@@ -44,7 +45,8 @@  discard block
 block discarded – undo
44 45
             [true, $callableNow, $now, true, true]
45 46
         ];
46 47
 
47
-        $callableFutureTime = static function () {
48
+        $callableFutureTime = static function ()
49
+        {
48 50
             return time() + 1000;
49 51
         };
50 52
         yield from [
@@ -52,7 +54,8 @@  discard block
 block discarded – undo
52 54
             [false, $callableFutureTime, $now, true, true],
53 55
         ];
54 56
 
55
-        $callablePastTime = static function () {
57
+        $callablePastTime = static function ()
58
+        {
56 59
             return time() - 1000;
57 60
         };
58 61
         yield from [
@@ -256,7 +259,8 @@  discard block
 block discarded – undo
256 259
     {
257 260
         $checker = new DatetimeChecker();
258 261
 
259
-        foreach (\DateTimeZone::listIdentifiers() as $identifier) {
262
+        foreach (\DateTimeZone::listIdentifiers() as $identifier)
263
+        {
260 264
             $this->assertTrue($checker->timezone($identifier));
261 265
             $this->assertFalse($checker->timezone(str_rot13($identifier)));
262 266
         }
@@ -397,21 +401,24 @@  discard block
 block discarded – undo
397 401
 
398 402
     private function now(): \Closure
399 403
     {
400
-        return static function () {
404
+        return static function ()
405
+        {
401 406
             return \time();
402 407
         };
403 408
     }
404 409
 
405 410
     private function inFuture(int $seconds): \Closure
406 411
     {
407
-        return static function () use ($seconds) {
412
+        return static function () use ($seconds)
413
+        {
408 414
             return \time() + $seconds;
409 415
         };
410 416
     }
411 417
 
412 418
     private function inPast(int $seconds): \Closure
413 419
     {
414
-        return static function () use ($seconds) {
420
+        return static function () use ($seconds)
421
+        {
415 422
             return \time() - $seconds;
416 423
         };
417 424
     }
Please login to merge, or discard this patch.
src/Framework/Domain/PipelineInterceptor.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
     public function process(string $controller, string $action, array $parameters, CoreInterface $core)
45 45
     {
46 46
         $annotation = $this->readAnnotation($controller, $action);
47
-        if ($core instanceof InterceptorPipeline && $annotation->skipNext) {
47
+        if ($core instanceof InterceptorPipeline && $annotation->skipNext){
48 48
             $this->removeNextInterceptorsFromOriginalPipeline($core);
49 49
         }
50 50
 
51 51
         $pipeline = $this->getCachedPipeline($controller, $action, $annotation);
52
-        if (!empty($pipeline)) {
53
-            if ($core instanceof InterceptorPipeline) {
52
+        if (!empty($pipeline)){
53
+            if ($core instanceof InterceptorPipeline){
54 54
                 $this->injectInterceptorsIntoOriginalPipeline($core, $pipeline);
55
-            } else {
55
+            }else{
56 56
                 $core = new InterceptableCore($core);
57
-                foreach ($pipeline as $interceptor) {
57
+                foreach ($pipeline as $interceptor){
58 58
                     $core->addInterceptor($interceptor);
59 59
                 }
60 60
             }
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
      */
71 71
     private function readAnnotation(string $controller, string $action): Pipeline
72 72
     {
73
-        try {
73
+        try{
74 74
             $method = new \ReflectionMethod($controller, $action);
75
-        } catch (\ReflectionException $e) {
75
+        }catch (\ReflectionException $e){
76 76
             return new Pipeline();
77 77
         }
78 78
 
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 
92 92
         $oldInterceptors = $pipelineReflection->getValue($pipeline);
93 93
         $newInterceptors = [];
94
-        foreach ($oldInterceptors as $interceptor) {
94
+        foreach ($oldInterceptors as $interceptor){
95 95
             $newInterceptors[] = $interceptor;
96
-            if ($interceptor instanceof self) {
96
+            if ($interceptor instanceof self){
97 97
                 break;
98 98
             }
99 99
         }
100 100
 
101
-        if (count($newInterceptors) !== count($oldInterceptors)) {
101
+        if (count($newInterceptors) !== count($oldInterceptors)){
102 102
             $pipelineReflection->setValue($pipeline, $newInterceptors);
103 103
         }
104 104
         $pipelineReflection->setAccessible(false);
@@ -111,16 +111,16 @@  discard block
 block discarded – undo
111 111
 
112 112
         $oldInterceptors = $pipelineReflection->getValue($pipeline);
113 113
         $newInterceptors = [];
114
-        foreach ($oldInterceptors as $interceptor) {
114
+        foreach ($oldInterceptors as $interceptor){
115 115
             $newInterceptors[] = $interceptor;
116
-            if ($interceptor instanceof self) {
117
-                foreach ($interceptors as $newInterceptor) {
116
+            if ($interceptor instanceof self){
117
+                foreach ($interceptors as $newInterceptor){
118 118
                     $newInterceptors[] = $newInterceptor;
119 119
                 }
120 120
             }
121 121
         }
122 122
 
123
-        if (count($newInterceptors) !== count($oldInterceptors)) {
123
+        if (count($newInterceptors) !== count($oldInterceptors)){
124 124
             $pipelineReflection->setValue($pipeline, $newInterceptors);
125 125
         }
126 126
         $pipelineReflection->setAccessible(false);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     private function getCachedPipeline(string $controller, string $action, Pipeline $annotation): array
136 136
     {
137 137
         $key = "{$controller}:{$action}";
138
-        if (!array_key_exists($key, $this->cache)) {
138
+        if (!array_key_exists($key, $this->cache)){
139 139
             $this->cache[$key] = $this->extractAnnotationPipeline($annotation);
140 140
         }
141 141
 
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
     private function extractAnnotationPipeline(Pipeline $annotation): array
150 150
     {
151 151
         $interceptors = [];
152
-        foreach ($annotation->pipeline as $interceptor) {
153
-            try {
152
+        foreach ($annotation->pipeline as $interceptor){
153
+            try{
154 154
                 $interceptors[] = $this->container->get($interceptor);
155
-            } catch (\Throwable $e) {
155
+            }catch (\Throwable $e){
156 156
             }
157 157
         }
158 158
 
Please login to merge, or discard this patch.
Braces   +39 added lines, -18 removed lines patch added patch discarded remove patch
@@ -44,17 +44,23 @@  discard block
 block discarded – undo
44 44
     public function process(string $controller, string $action, array $parameters, CoreInterface $core)
45 45
     {
46 46
         $annotation = $this->readAnnotation($controller, $action);
47
-        if ($core instanceof InterceptorPipeline && $annotation->skipNext) {
47
+        if ($core instanceof InterceptorPipeline && $annotation->skipNext)
48
+        {
48 49
             $this->removeNextInterceptorsFromOriginalPipeline($core);
49 50
         }
50 51
 
51 52
         $pipeline = $this->getCachedPipeline($controller, $action, $annotation);
52
-        if (!empty($pipeline)) {
53
-            if ($core instanceof InterceptorPipeline) {
53
+        if (!empty($pipeline))
54
+        {
55
+            if ($core instanceof InterceptorPipeline)
56
+            {
54 57
                 $this->injectInterceptorsIntoOriginalPipeline($core, $pipeline);
55
-            } else {
58
+            }
59
+            else
60
+            {
56 61
                 $core = new InterceptableCore($core);
57
-                foreach ($pipeline as $interceptor) {
62
+                foreach ($pipeline as $interceptor)
63
+                {
58 64
                     $core->addInterceptor($interceptor);
59 65
                 }
60 66
             }
@@ -70,9 +76,12 @@  discard block
 block discarded – undo
70 76
      */
71 77
     private function readAnnotation(string $controller, string $action): Pipeline
72 78
     {
73
-        try {
79
+        try
80
+        {
74 81
             $method = new \ReflectionMethod($controller, $action);
75
-        } catch (\ReflectionException $e) {
82
+        }
83
+        catch (\ReflectionException $e)
84
+        {
76 85
             return new Pipeline();
77 86
         }
78 87
 
@@ -91,14 +100,17 @@  discard block
 block discarded – undo
91 100
 
92 101
         $oldInterceptors = $pipelineReflection->getValue($pipeline);
93 102
         $newInterceptors = [];
94
-        foreach ($oldInterceptors as $interceptor) {
103
+        foreach ($oldInterceptors as $interceptor)
104
+        {
95 105
             $newInterceptors[] = $interceptor;
96
-            if ($interceptor instanceof self) {
106
+            if ($interceptor instanceof self)
107
+            {
97 108
                 break;
98 109
             }
99 110
         }
100 111
 
101
-        if (count($newInterceptors) !== count($oldInterceptors)) {
112
+        if (count($newInterceptors) !== count($oldInterceptors))
113
+        {
102 114
             $pipelineReflection->setValue($pipeline, $newInterceptors);
103 115
         }
104 116
         $pipelineReflection->setAccessible(false);
@@ -111,16 +123,20 @@  discard block
 block discarded – undo
111 123
 
112 124
         $oldInterceptors = $pipelineReflection->getValue($pipeline);
113 125
         $newInterceptors = [];
114
-        foreach ($oldInterceptors as $interceptor) {
126
+        foreach ($oldInterceptors as $interceptor)
127
+        {
115 128
             $newInterceptors[] = $interceptor;
116
-            if ($interceptor instanceof self) {
117
-                foreach ($interceptors as $newInterceptor) {
129
+            if ($interceptor instanceof self)
130
+            {
131
+                foreach ($interceptors as $newInterceptor)
132
+                {
118 133
                     $newInterceptors[] = $newInterceptor;
119 134
                 }
120 135
             }
121 136
         }
122 137
 
123
-        if (count($newInterceptors) !== count($oldInterceptors)) {
138
+        if (count($newInterceptors) !== count($oldInterceptors))
139
+        {
124 140
             $pipelineReflection->setValue($pipeline, $newInterceptors);
125 141
         }
126 142
         $pipelineReflection->setAccessible(false);
@@ -135,7 +151,8 @@  discard block
 block discarded – undo
135 151
     private function getCachedPipeline(string $controller, string $action, Pipeline $annotation): array
136 152
     {
137 153
         $key = "{$controller}:{$action}";
138
-        if (!array_key_exists($key, $this->cache)) {
154
+        if (!array_key_exists($key, $this->cache))
155
+        {
139 156
             $this->cache[$key] = $this->extractAnnotationPipeline($annotation);
140 157
         }
141 158
 
@@ -149,10 +166,14 @@  discard block
 block discarded – undo
149 166
     private function extractAnnotationPipeline(Pipeline $annotation): array
150 167
     {
151 168
         $interceptors = [];
152
-        foreach ($annotation->pipeline as $interceptor) {
153
-            try {
169
+        foreach ($annotation->pipeline as $interceptor)
170
+        {
171
+            try
172
+            {
154 173
                 $interceptors[] = $this->container->get($interceptor);
155
-            } catch (\Throwable $e) {
174
+            }
175
+            catch (\Throwable $e)
176
+            {
156 177
             }
157 178
         }
158 179
 
Please login to merge, or discard this patch.