@@ -16,7 +16,7 @@ discard block |
||
| 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,30 +26,30 @@ discard block |
||
| 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 | - foreach ($this->registry->getSetters() as $setter) { |
|
| 36 | - if (!empty($map[Builder::SCHEMA_FILTER])) { |
|
| 35 | + foreach ($this->registry->getSetters() as $setter){ |
|
| 36 | + if (!empty($map[Builder::SCHEMA_FILTER])){ |
|
| 37 | 37 | $this->registry->getDefault()->setValue($filter, $property, $data[$field]); |
| 38 | 38 | break; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $type = $property->getType(); |
| 42 | - if (!isset($data[$field]) && $type->allowsNull()) { |
|
| 42 | + if (!isset($data[$field]) && $type->allowsNull()){ |
|
| 43 | 43 | $this->registry->getDefault()->setValue($filter, $property, null); |
| 44 | 44 | break; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - if (!$type instanceof \ReflectionNamedType || $type->isBuiltin()) { |
|
| 47 | + if (!$type instanceof \ReflectionNamedType || $type->isBuiltin()){ |
|
| 48 | 48 | $this->registry->getDefault()->setValue($filter, $property, $data[$field]); |
| 49 | 49 | break; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - if ($setter->supports($type)) { |
|
| 52 | + if ($setter->supports($type)){ |
|
| 53 | 53 | $setter->setValue($filter, $property, $data[$field]); |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -26,30 +26,37 @@ |
||
| 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 | - foreach ($this->registry->getSetters() as $setter) { |
|
| 36 | - if (!empty($map[Builder::SCHEMA_FILTER])) { |
|
| 37 | + foreach ($this->registry->getSetters() as $setter) |
|
| 38 | + { |
|
| 39 | + if (!empty($map[Builder::SCHEMA_FILTER])) |
|
| 40 | + { |
|
| 37 | 41 | $this->registry->getDefault()->setValue($filter, $property, $data[$field]); |
| 38 | 42 | break; |
| 39 | 43 | } |
| 40 | 44 | |
| 41 | 45 | $type = $property->getType(); |
| 42 | - if (!isset($data[$field]) && $type->allowsNull()) { |
|
| 46 | + if (!isset($data[$field]) && $type->allowsNull()) |
|
| 47 | + { |
|
| 43 | 48 | $this->registry->getDefault()->setValue($filter, $property, null); |
| 44 | 49 | break; |
| 45 | 50 | } |
| 46 | 51 | |
| 47 | - if (!$type instanceof \ReflectionNamedType || $type->isBuiltin()) { |
|
| 52 | + if (!$type instanceof \ReflectionNamedType || $type->isBuiltin()) |
|
| 53 | + { |
|
| 48 | 54 | $this->registry->getDefault()->setValue($filter, $property, $data[$field]); |
| 49 | 55 | break; |
| 50 | 56 | } |
| 51 | 57 | |
| 52 | - if ($setter->supports($type)) { |
|
| 58 | + if ($setter->supports($type)) |
|
| 59 | + { |
|
| 53 | 60 | $setter->setValue($filter, $property, $data[$field]); |
| 54 | 61 | } |
| 55 | 62 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | public function supports(\ReflectionNamedType $type): bool |
| 15 | 15 | { |
| 16 | - if ($this->interfaceExists === null) { |
|
| 16 | + if ($this->interfaceExists === null){ |
|
| 17 | 17 | $this->interfaceExists = \interface_exists(UuidInterface::class); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -27,16 +27,16 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | private function implements(string $haystack, string $interface): bool |
| 29 | 29 | { |
| 30 | - if ($haystack === $interface) { |
|
| 30 | + if ($haystack === $interface){ |
|
| 31 | 31 | return true; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - foreach ((array)\class_implements($haystack) as $implements) { |
|
| 35 | - if ($implements === $interface) { |
|
| 34 | + foreach ((array)\class_implements($haystack) as $implements){ |
|
| 35 | + if ($implements === $interface){ |
|
| 36 | 36 | return true; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if (self::implements($implements, $interface)) { |
|
| 39 | + if (self::implements($implements, $interface)){ |
|
| 40 | 40 | return true; |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -13,7 +13,8 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | public function supports(\ReflectionNamedType $type): bool |
| 15 | 15 | { |
| 16 | - if ($this->interfaceExists === null) { |
|
| 16 | + if ($this->interfaceExists === null) |
|
| 17 | + { |
|
| 17 | 18 | $this->interfaceExists = \interface_exists(UuidInterface::class); |
| 18 | 19 | } |
| 19 | 20 | |
@@ -27,16 +28,20 @@ discard block |
||
| 27 | 28 | |
| 28 | 29 | private function implements(string $haystack, string $interface): bool |
| 29 | 30 | { |
| 30 | - if ($haystack === $interface) { |
|
| 31 | + if ($haystack === $interface) |
|
| 32 | + { |
|
| 31 | 33 | return true; |
| 32 | 34 | } |
| 33 | 35 | |
| 34 | - foreach ((array)\class_implements($haystack) as $implements) { |
|
| 35 | - if ($implements === $interface) { |
|
| 36 | + foreach ((array)\class_implements($haystack) as $implements) |
|
| 37 | + { |
|
| 38 | + if ($implements === $interface) |
|
| 39 | + { |
|
| 36 | 40 | return true; |
| 37 | 41 | } |
| 38 | 42 | |
| 39 | - if (self::implements($implements, $interface)) { |
|
| 43 | + if (self::implements($implements, $interface)) |
|
| 44 | + { |
|
| 40 | 45 | return true; |
| 41 | 46 | } |
| 42 | 47 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | private readonly CoreInterface $validationCore, |
| 26 | 26 | private readonly FilterFactory $filterFactory, |
| 27 | 27 | private readonly SchemaProviderInterface $schemaProvider |
| 28 | - ) { |
|
| 28 | + ){ |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function createFilter(string $name, InputInterface $input): FilterInterface |
@@ -14,7 +14,7 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -22,7 +22,8 @@ |
||
| 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 | |
@@ -52,7 +52,7 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -106,12 +106,14 @@ |
||
| 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 | |