@@ -31,7 +31,7 @@ |
||
31 | 31 | // Creates processor. |
32 | 32 | $processor = new StoreProcessor($store, $identityFactory, $productResolver); |
33 | 33 | |
34 | -$dispatcher->addListener(Events::PURCHASE_FINISHED, function (PurchaseFinished $event): void { |
|
34 | +$dispatcher->addListener(Events::PURCHASE_FINISHED, function(PurchaseFinished $event): void { |
|
35 | 35 | $product = $event->product(); |
36 | 36 | |
37 | 37 | // User 'john.doe' paid 10 credits for 'Services' product. |
@@ -41,27 +41,27 @@ discard block |
||
41 | 41 | return (new ArrayNodeDefinition($name)) |
42 | 42 | ->addDefaultsIfNotSet() |
43 | 43 | ->beforeNormalization() |
44 | - ->ifTrue(function (array $config): bool { |
|
44 | + ->ifTrue(function(array $config): bool { |
|
45 | 45 | return !isset($config['type']); |
46 | 46 | }) |
47 | - ->then(function (array $config): array { |
|
47 | + ->then(function(array $config): array { |
|
48 | 48 | return ['type' => self::WALLET_FIXED, 'accounts' => $config]; |
49 | 49 | }) |
50 | 50 | ->end() |
51 | 51 | ->validate() |
52 | - ->ifTrue(function (array $config): bool { |
|
52 | + ->ifTrue(function(array $config): bool { |
|
53 | 53 | return self::WALLET_SERVICE === $config['type'] && empty($config['factory_service_id']); |
54 | 54 | }) |
55 | 55 | ->thenInvalid('Service id must be specified.') |
56 | 56 | ->end() |
57 | 57 | ->validate() |
58 | - ->ifTrue(function (array $config): bool { |
|
58 | + ->ifTrue(function(array $config): bool { |
|
59 | 59 | return self::WALLET_REDIS === $config['type'] && (empty($config['redis_client_id']) || empty($config['wallet_key'])); |
60 | 60 | }) |
61 | 61 | ->thenInvalid('Wallet key and Redis client must be specified.') |
62 | 62 | ->end() |
63 | 63 | ->validate() |
64 | - ->ifTrue(function (array $config) { |
|
64 | + ->ifTrue(function(array $config) { |
|
65 | 65 | return self::WALLET_MONGO === $config['type'] && (empty($config['mongo_client_id']) || empty($config['db_name']) || empty($config['collection_name'])); |
66 | 66 | }) |
67 | 67 | ->thenInvalid('Mongo client, database and collection name must be specified.') |
@@ -102,18 +102,18 @@ discard block |
||
102 | 102 | ->addDefaultsIfNotSet() |
103 | 103 | ->beforeNormalization() |
104 | 104 | ->ifString() |
105 | - ->then(function (string $config): array { |
|
105 | + ->then(function(string $config): array { |
|
106 | 106 | return ['type' => self::IDENTITY_FIXED, 'identity' => $config]; |
107 | 107 | }) |
108 | 108 | ->end() |
109 | 109 | ->validate() |
110 | - ->ifTrue(function (array $config): bool { |
|
110 | + ->ifTrue(function(array $config): bool { |
|
111 | 111 | return self::IDENTITY_SERVICE === $config['type'] && empty($config['factory_service_id']); |
112 | 112 | }) |
113 | 113 | ->thenInvalid('Service id must be specified.') |
114 | 114 | ->end() |
115 | 115 | ->validate() |
116 | - ->ifTrue(function (array $config): bool { |
|
116 | + ->ifTrue(function(array $config): bool { |
|
117 | 117 | return self::IDENTITY_FIXED === $config['type'] && empty($config['identity']); |
118 | 118 | }) |
119 | 119 | ->thenInvalid('Identity must be specified.') |
@@ -137,15 +137,15 @@ discard block |
||
137 | 137 | ->requiresAtLeastOneElement() |
138 | 138 | ->beforeNormalization() |
139 | 139 | ->ifString() |
140 | - ->then(function (string $config) use ($defaults): array { |
|
140 | + ->then(function(string $config) use ($defaults): array { |
|
141 | 141 | return [array_replace($defaults, ['name' => $config])]; |
142 | 142 | }) |
143 | 143 | ->end() |
144 | 144 | ->beforeNormalization() |
145 | - ->ifTrue(function ($config): bool { |
|
145 | + ->ifTrue(function($config): bool { |
|
146 | 146 | return is_numeric($config); |
147 | 147 | }) |
148 | - ->then(function (int $config) use ($defaults): array { |
|
148 | + ->then(function(int $config) use ($defaults): array { |
|
149 | 149 | return [array_replace($defaults, ['price' => $config])]; |
150 | 150 | }) |
151 | 151 | ->end() |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | return (new ArrayNodeDefinition($name)) |
186 | 186 | ->beforeNormalization() |
187 | 187 | ->ifString() |
188 | - ->then(function (string $config): array { |
|
188 | + ->then(function(string $config): array { |
|
189 | 189 | return ['path' => $config]; |
190 | 190 | }) |
191 | 191 | ->end() |