Passed
Pull Request — master (#961)
by Maxim
09:08
created
src/Filters/src/Model/Factory/FilterFactory.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 {
15 15
     public function __construct(
16 16
         private readonly ResolverInterface $resolver,
17
-    ) {
17
+    ){
18 18
     }
19 19
 
20 20
     public function createFilterInstance(string $name): FilterInterface
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         $class = new \ReflectionClass($name);
23 23
 
24 24
         $args = [];
25
-        if ($constructor = $class->getConstructor()) {
25
+        if ($constructor = $class->getConstructor()){
26 26
             $args = $this->resolver->resolveArguments($constructor);
27 27
         }
28 28
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,8 @@
 block discarded – undo
22 22
         $class = new \ReflectionClass($name);
23 23
 
24 24
         $args = [];
25
-        if ($constructor = $class->getConstructor()) {
25
+        if ($constructor = $class->getConstructor())
26
+        {
26 27
             $args = $this->resolver->resolveArguments($constructor);
27 28
         }
28 29
 
Please login to merge, or discard this patch.
src/Framework/Bootloader/Security/FiltersBootloader.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         private readonly ContainerInterface $container,
53 53
         private readonly BinderInterface $binder,
54 54
         private readonly ConfiguratorInterface $config
55
-    ) {
55
+    ){
56 56
     }
57 57
 
58 58
     /**
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
         ?EventDispatcherInterface $dispatcher = null
107 107
     ): FilterProvider {
108 108
         $core = new InterceptableCore(new Core(), $dispatcher);
109
-        foreach ($config->getInterceptors() as $interceptor) {
109
+        foreach ($config->getInterceptors() as $interceptor){
110 110
             $core->addInterceptor($container->get($interceptor));
111 111
         }
112 112
 
113 113
         $validationCode = new InterceptableCore(new ValidationCore($container), $dispatcher);
114
-        foreach ($config->getValidationInterceptors() as $interceptor) {
114
+        foreach ($config->getValidationInterceptors() as $interceptor){
115 115
             $validationCode->addInterceptor($container->get($interceptor));
116 116
         }
117 117
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -106,12 +106,14 @@
 block discarded – undo
106 106
         ?EventDispatcherInterface $dispatcher = null
107 107
     ): FilterProvider {
108 108
         $core = new InterceptableCore(new Core(), $dispatcher);
109
-        foreach ($config->getInterceptors() as $interceptor) {
109
+        foreach ($config->getInterceptors() as $interceptor)
110
+        {
110 111
             $core->addInterceptor($container->get($interceptor));
111 112
         }
112 113
 
113 114
         $validationCode = new InterceptableCore(new ValidationCore($container), $dispatcher);
114
-        foreach ($config->getValidationInterceptors() as $interceptor) {
115
+        foreach ($config->getValidationInterceptors() as $interceptor)
116
+        {
115 117
             $validationCode->addInterceptor($container->get($interceptor));
116 118
         }
117 119
 
Please login to merge, or discard this patch.
src/Filters/src/Model/Schema/Builder.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -42,18 +42,18 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function makeSchema(string $name, array $schema): array
44 44
     {
45
-        if (empty($schema)) {
45
+        if (empty($schema)){
46 46
             throw new SchemaException(\sprintf('Filter `%s` does not define any schema', $name));
47 47
         }
48 48
 
49 49
         $result = [];
50
-        foreach ($schema as $field => $definition) {
50
+        foreach ($schema as $field => $definition){
51 51
             $optional = false;
52 52
 
53 53
             // short definition
54
-            if (\is_string($definition)) {
54
+            if (\is_string($definition)){
55 55
                 // simple scalar field definition
56
-                if (!\class_exists($definition)) {
56
+                if (!\class_exists($definition)){
57 57
                     [$source, $origin] = $this->parseDefinition($field, $definition);
58 58
                     $result[$field] = [
59 59
                         self::SCHEMA_SOURCE => $source,
@@ -74,25 +74,25 @@  discard block
 block discarded – undo
74 74
                 continue;
75 75
             }
76 76
 
77
-            if (!\is_array($definition) || $definition === []) {
77
+            if (!\is_array($definition) || $definition === []){
78 78
                 throw new SchemaException(
79 79
                     \sprintf('Invalid schema definition at `%s`->`%s`', $name, $field)
80 80
                 );
81 81
             }
82 82
 
83 83
             // complex definition
84
-            if (!empty($definition[self::ORIGIN])) {
84
+            if (!empty($definition[self::ORIGIN])){
85 85
                 $origin = $definition[self::ORIGIN];
86 86
 
87 87
                 // [class, 'data:something.*'] vs [class, 'data:something']
88 88
                 $iterate = \str_contains((string)$origin, '.*') || !empty($definition[self::ITERATE]);
89 89
                 $origin = \rtrim($origin, '.*');
90
-            } else {
90
+            }else{
91 91
                 $origin = $field;
92 92
                 $iterate = true;
93 93
             }
94 94
 
95
-            if (!empty($definition[self::OPTIONAL])) {
95
+            if (!empty($definition[self::OPTIONAL])){
96 96
                 $optional = true;
97 97
             }
98 98
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
                 self::SCHEMA_OPTIONAL => $optional,
106 106
             ];
107 107
 
108
-            if ($iterate) {
108
+            if ($iterate){
109 109
                 [$source, $origin] = $this->parseDefinition($field, $definition[self::ITERATE] ?? $origin);
110 110
 
111 111
                 $map[self::SCHEMA_ITERATE_SOURCE] = $source;
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
             'path',
138 138
             'remoteAddress',
139 139
             'uri',
140
-        ], true)) {
140
+        ], true)){
141 141
             return [$definition, $field];
142 142
         }
143 143
 
144
-        if (!\str_contains($definition, ':')) {
144
+        if (!\str_contains($definition, ':')){
145 145
             return ['data', empty($definition) ? $field : $definition];
146 146
         }
147 147
 
Please login to merge, or discard this patch.
Braces   +23 added lines, -11 removed lines patch added patch discarded remove patch
@@ -42,18 +42,22 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function makeSchema(string $name, array $schema): array
44 44
     {
45
-        if (empty($schema)) {
45
+        if (empty($schema))
46
+        {
46 47
             throw new SchemaException(\sprintf('Filter `%s` does not define any schema', $name));
47 48
         }
48 49
 
49 50
         $result = [];
50
-        foreach ($schema as $field => $definition) {
51
+        foreach ($schema as $field => $definition)
52
+        {
51 53
             $optional = false;
52 54
 
53 55
             // short definition
54
-            if (\is_string($definition)) {
56
+            if (\is_string($definition))
57
+            {
55 58
                 // simple scalar field definition
56
-                if (!\class_exists($definition)) {
59
+                if (!\class_exists($definition))
60
+                {
57 61
                     [$source, $origin] = $this->parseDefinition($field, $definition);
58 62
                     $result[$field] = [
59 63
                         self::SCHEMA_SOURCE => $source,
@@ -74,25 +78,30 @@  discard block
 block discarded – undo
74 78
                 continue;
75 79
             }
76 80
 
77
-            if (!\is_array($definition) || $definition === []) {
81
+            if (!\is_array($definition) || $definition === [])
82
+            {
78 83
                 throw new SchemaException(
79 84
                     \sprintf('Invalid schema definition at `%s`->`%s`', $name, $field)
80 85
                 );
81 86
             }
82 87
 
83 88
             // complex definition
84
-            if (!empty($definition[self::ORIGIN])) {
89
+            if (!empty($definition[self::ORIGIN]))
90
+            {
85 91
                 $origin = $definition[self::ORIGIN];
86 92
 
87 93
                 // [class, 'data:something.*'] vs [class, 'data:something']
88 94
                 $iterate = \str_contains((string)$origin, '.*') || !empty($definition[self::ITERATE]);
89 95
                 $origin = \rtrim($origin, '.*');
90
-            } else {
96
+            }
97
+            else
98
+            {
91 99
                 $origin = $field;
92 100
                 $iterate = true;
93 101
             }
94 102
 
95
-            if (!empty($definition[self::OPTIONAL])) {
103
+            if (!empty($definition[self::OPTIONAL]))
104
+            {
96 105
                 $optional = true;
97 106
             }
98 107
 
@@ -105,7 +114,8 @@  discard block
 block discarded – undo
105 114
                 self::SCHEMA_OPTIONAL => $optional,
106 115
             ];
107 116
 
108
-            if ($iterate) {
117
+            if ($iterate)
118
+            {
109 119
                 [$source, $origin] = $this->parseDefinition($field, $definition[self::ITERATE] ?? $origin);
110 120
 
111 121
                 $map[self::SCHEMA_ITERATE_SOURCE] = $source;
@@ -137,11 +147,13 @@  discard block
 block discarded – undo
137 147
             'path',
138 148
             'remoteAddress',
139 149
             'uri',
140
-        ], true)) {
150
+        ], true))
151
+        {
141 152
             return [$definition, $field];
142 153
         }
143 154
 
144
-        if (!\str_contains($definition, ':')) {
155
+        if (!\str_contains($definition, ':'))
156
+        {
145 157
             return ['data', empty($definition) ? $field : $definition];
146 158
         }
147 159
 
Please login to merge, or discard this patch.
src/Filters/src/Model/Mapper/Mapper.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     public function __construct(
17 17
         private readonly SchemaProviderInterface $schemaProvider,
18 18
         private readonly SetterRegistryInterface $registry
19
-    ) {
19
+    ){
20 20
     }
21 21
 
22 22
     /**
@@ -26,29 +26,29 @@  discard block
 block discarded – undo
26 26
     {
27 27
         $class = new \ReflectionClass($filter);
28 28
 
29
-        foreach ($this->schemaProvider->getSchema($filter) as $field => $map) {
30
-            if (!empty($map[Builder::SCHEMA_FILTER]) && $data[$field] === []) {
29
+        foreach ($this->schemaProvider->getSchema($filter) as $field => $map){
30
+            if (!empty($map[Builder::SCHEMA_FILTER]) && $data[$field] === []){
31 31
                 continue;
32 32
             }
33 33
 
34 34
             $property = $class->getProperty($field);
35
-            if (!empty($map[Builder::SCHEMA_FILTER])) {
35
+            if (!empty($map[Builder::SCHEMA_FILTER])){
36 36
                 $this->registry->getDefault()->setValue($filter, $property, $data[$field]);
37 37
                 continue;
38 38
             }
39 39
             $type = $property->getType();
40
-            if (!isset($data[$field]) && $type->allowsNull()) {
40
+            if (!isset($data[$field]) && $type->allowsNull()){
41 41
                 $this->registry->getDefault()->setValue($filter, $property, null);
42 42
                 continue;
43 43
             }
44 44
 
45
-            if (!$type instanceof \ReflectionNamedType || $type->isBuiltin()) {
45
+            if (!$type instanceof \ReflectionNamedType || $type->isBuiltin()){
46 46
                 $this->registry->getDefault()->setValue($filter, $property, $data[$field]);
47 47
                 continue;
48 48
             }
49 49
 
50
-            foreach ($this->registry->getSetters() as $setter) {
51
-                if ($setter->supports($type)) {
50
+            foreach ($this->registry->getSetters() as $setter){
51
+                if ($setter->supports($type)){
52 52
                     $setter->setValue($filter, $property, $data[$field]);
53 53
                 }
54 54
             }
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,29 +26,36 @@
 block discarded – undo
26 26
     {
27 27
         $class = new \ReflectionClass($filter);
28 28
 
29
-        foreach ($this->schemaProvider->getSchema($filter) as $field => $map) {
30
-            if (!empty($map[Builder::SCHEMA_FILTER]) && $data[$field] === []) {
29
+        foreach ($this->schemaProvider->getSchema($filter) as $field => $map)
30
+        {
31
+            if (!empty($map[Builder::SCHEMA_FILTER]) && $data[$field] === [])
32
+            {
31 33
                 continue;
32 34
             }
33 35
 
34 36
             $property = $class->getProperty($field);
35
-            if (!empty($map[Builder::SCHEMA_FILTER])) {
37
+            if (!empty($map[Builder::SCHEMA_FILTER]))
38
+            {
36 39
                 $this->registry->getDefault()->setValue($filter, $property, $data[$field]);
37 40
                 continue;
38 41
             }
39 42
             $type = $property->getType();
40
-            if (!isset($data[$field]) && $type->allowsNull()) {
43
+            if (!isset($data[$field]) && $type->allowsNull())
44
+            {
41 45
                 $this->registry->getDefault()->setValue($filter, $property, null);
42 46
                 continue;
43 47
             }
44 48
 
45
-            if (!$type instanceof \ReflectionNamedType || $type->isBuiltin()) {
49
+            if (!$type instanceof \ReflectionNamedType || $type->isBuiltin())
50
+            {
46 51
                 $this->registry->getDefault()->setValue($filter, $property, $data[$field]);
47 52
                 continue;
48 53
             }
49 54
 
50
-            foreach ($this->registry->getSetters() as $setter) {
51
-                if ($setter->supports($type)) {
55
+            foreach ($this->registry->getSetters() as $setter)
56
+            {
57
+                if ($setter->supports($type))
58
+                {
52 59
                     $setter->setValue($filter, $property, $data[$field]);
53 60
                 }
54 61
             }
Please login to merge, or discard this patch.